File tree Expand file tree Collapse file tree
examples/egui_todolist/src Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- use std:: { str:: FromStr , sync:: Arc } ;
2-
31use async_trait:: async_trait;
42use futures_lite:: StreamExt ;
53use log:: warn;
@@ -10,7 +8,7 @@ use powersync::{
108 error:: PowerSyncError ,
119 schema:: { Column , Schema , Table } ,
1210} ;
13- use reqwest:: { Method , Request , StatusCode } ;
11+ use reqwest:: StatusCode ;
1412use rusqlite:: { Connection , params} ;
1513use serde:: { Deserialize , Serialize } ;
1614use serde_json:: { Map , Value } ;
Original file line number Diff line number Diff line change @@ -23,16 +23,14 @@ pub trait HttpClient: Send + Sync + 'static {
2323}
2424
2525/// A request sent by the PowerSync SDK.
26+ #[ non_exhaustive]
2627pub struct Request {
2728 pub method : & ' static str ,
2829 pub url : Url ,
2930 pub headers : Vec < ( & ' static str , Cow < ' static , str > ) > ,
3031 /// This crate doesn't use streaming request bodies, so requests will contain the full request
3132 /// body as a byte vector.
3233 pub body : Option < Vec < u8 > > ,
33-
34- // Ensure that requests can only be created within the PowerSync SDK.
35- pub ( crate ) _internal : ( ) ,
3634}
3735
3836/// Information about http responses used by the PowerSync SDK.
@@ -89,11 +87,7 @@ impl HttpClient for ReqwestClient {
8987 wrapped
9088 } ;
9189
92- let mut response = self
93- . execute ( req)
94- . await
95- . map_err ( |e| RawPowerSyncError :: from ( e) ) ?;
96-
90+ let response = self . execute ( req) . await . map_err ( RawPowerSyncError :: from) ?;
9791 let status = response. status ( ) . as_u16 ( ) ;
9892 let content_type = response
9993 . headers ( )
Original file line number Diff line number Diff line change @@ -36,7 +36,6 @@ pub fn sync_stream(
3636 headers
3737 } ,
3838 body : Some ( request_body. into_bytes ( ) ) ,
39- _internal : ( ) ,
4039 } ;
4140
4241 let response = db. env . client . send ( request) . await ?;
@@ -75,7 +74,6 @@ pub async fn write_checkpoint(
7574 headers
7675 } ,
7776 body : None ,
78- _internal : ( ) ,
7977 } ;
8078
8179 let response = db. env . client . send ( request) . await ?;
You can’t perform that action at this time.
0 commit comments