Struct supabase_storage::Storage
source · 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)
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
async fn main() {
dotenv().ok();
let config = SupabaseConfig::default();
let storage = Storage::new_with_config(config);
let bucket_name = "thefux";
let object = "btc.pdf";
let response = storage
.from()
.get_object(bucket_name, object)
.execute()
.await
.unwrap();
println!("{:?}", response);
}
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)
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
async fn main() {
dotenv().ok();
let config = SupabaseConfig::default();
let storage = Storage::new_with_config(config);
let bucket_name = "thefux";
let object = "btc.pdf";
let response = storage
.from()
.get_object(bucket_name, object)
.execute()
.await
.unwrap();
println!("{:?}", response);
}
Auto Trait Implementations§
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