pub struct Storage { /* private fields */ }
Expand description
A struct representing a Storage with an associated client and headers.
Implementationsยง
Sourceยงimpl Storage
impl Storage
Sourcepub fn new_with_config(config: SupabaseConfig) -> Self
pub fn new_with_config(config: SupabaseConfig) -> Self
Creates a new Storage
instance with provided configuration.
ยงArguments
config
- TheSupabaseConfig
containing the necessary configuration for Supabase.
ยงExample
use supabase_storage::{Storage, config::SupabaseConfig};
use dotenv::dotenv;
dotenv().ok();
let config = SupabaseConfig::default(); // load values from .env file using the 'envy' crate
let storage = Storage::new_with_config(config);
Examples found in repository?
examples/get_object.rs (line 10)
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 fn from(&self) -> Builder
pub fn from(&self) -> Builder
Creates a new Builder
instance to build an action
ยงExample
use supabase_storage::Storage;
let storage = Storage::new("https://your_project_path/storage/v1");
let builder = storage.from();
Examples found in repository?
examples/get_object.rs (line 16)
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}
Auto Trait Implementationsยง
impl Freeze for Storage
impl !RefUnwindSafe for Storage
impl Send for Storage
impl Sync for Storage
impl Unpin for Storage
impl !UnwindSafe for Storage
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