pub struct Executor {
pub builder: Builder,
}
Fieldsยง
ยงbuilder: Builder
Implementationsยง
Sourceยงimpl Executor
impl Executor
Sourcepub fn new(builder: Builder) -> Self
pub fn new(builder: Builder) -> Self
Creates a new Executor
instance with the provided HTTP method, URL, client, and headers.
ยงArguments
method
- The HTTP method for the request.url
- The URL for the request.client
- TheClient
to use for making the request.headers
- TheHeaderMap
containing the headers for the request.
Sourcepub async fn execute(self) -> Result<Response, Error>
pub async fn execute(self) -> Result<Response, Error>
Executes the constructed HTTP request and returns the response as a Result
.
ยงReturns
Result<Response, Error>
- The result of the executed request.
ยงExample
use supabase_storage::{
Storage,
config::SupabaseConfig,
};
use dotenv::dotenv;
#[tokio::main]
async fn main() {
dotenv().ok();
let config = SupabaseConfig::default();
let storage = Storage::new_with_config(config);
let response = storage
.from()
.get_bucket_details("thefux")
.execute()
.await
.unwrap()
.text()
.await
.unwrap();
// Now 'response' contains the reponse as text.
println!("{:?}", response);
}
Examples found in repository?
examples/get_object.rs (line 18)
6async fn main() {
7 dotenv().ok();
8
9 let config = SupabaseConfig::default();
10 let storage = Storage::new_with_config(config);
11
12 let bucket_name = "thefux";
13 let object = "btc.pdf";
14
15 let response = storage
16 .from()
17 .get_object(bucket_name, object)
18 .execute()
19 .await
20 .unwrap();
21
22 println!("{:?}", response);
23}
Sourcepub async fn execute_from<T>(self) -> Result<T, Error>where
T: for<'de> Deserialize<'de>,
pub async fn execute_from<T>(self) -> Result<T, Error>where
T: for<'de> Deserialize<'de>,
Executes the constructed HTTP request and deserializes the response body into a generic struct.
ยงReturns
Result<T, errors::Error>
- The result of deserializing the response body into the provided generic struct.
ยงExample
use supabase_storage::{
Storage,
config::SupabaseConfig,
model::bucket::BucketDetails,
};
use dotenv::dotenv;
#[tokio::main]
async fn main() {
dotenv().ok();
let config = SupabaseConfig::default();
let storage = Storage::new_with_config(config);
let response = storage
.from()
.get_bucket_details("thefux")
.execute_from::<BucketDetails>()
.await;
// Now 'response' contains the deserialized 'BucketDetails' based on the response.
println!("{:?}", response);
}
Auto Trait Implementationsยง
impl !Freeze for Executor
impl !RefUnwindSafe for Executor
impl Send for Executor
impl Sync for Executor
impl Unpin for Executor
impl !UnwindSafe for Executor
Blanket Implementationsยง
Sourceยงimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Sourceยงfn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more