pub struct Storage { /* private fields */ }Expand description
Unified Storage Engine Client
Implementations§
Source§impl Storage
impl Storage
Sourcepub fn s3(bucket: impl Into<String>, region: impl Into<String>) -> Self
pub fn s3(bucket: impl Into<String>, region: impl Into<String>) -> Self
Initialize AWS S3 storage provider
Sourcepub fn r2(bucket: impl Into<String>, account_id: impl Into<String>) -> Self
pub fn r2(bucket: impl Into<String>, account_id: impl Into<String>) -> Self
Initialize Cloudflare R2 storage provider
Sourcepub async fn put(
&self,
relative_path: &str,
bytes: &[u8],
) -> Result<(), StorageError>
pub async fn put( &self, relative_path: &str, bytes: &[u8], ) -> Result<(), StorageError>
Put binary payload to target path
Sourcepub async fn get(&self, relative_path: &str) -> Result<Vec<u8>, StorageError>
pub async fn get(&self, relative_path: &str) -> Result<Vec<u8>, StorageError>
Retrieve binary payload from target path
Sourcepub fn url(&self, relative_path: &str) -> Result<String, StorageError>
pub fn url(&self, relative_path: &str) -> Result<String, StorageError>
Public URL resolution helper for uploaded asset.
Each key segment is percent-encoded (every byte except the unreserved
A-Z a-z 0-9 - . _ ~), so #, ?, %, spaces and non-ASCII names
stay part of the object key. Local storage returns the root-relative
/storage/<key> path, exactly like LocalDriver::url; the
application serves its base directory at /storage. The filesystem
base path never appears in the URL.
Sourcepub fn resize_webp(
&self,
bytes: &[u8],
_width: u32,
_height: u32,
) -> Result<Vec<u8>, StorageError>
pub fn resize_webp( &self, bytes: &[u8], _width: u32, _height: u32, ) -> Result<Vec<u8>, StorageError>
Resize media buffer pipeline helper
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Storage
impl RefUnwindSafe for Storage
impl Send for Storage
impl Sync for Storage
impl Unpin for Storage
impl UnsafeUnpin 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