pub struct Stack0FileStorage { /* private fields */ }Expand description
File storage backed by Stack0’s CDN.
Uploads use a 3-step flow: POST /cdn/upload to mint a presigned URL,
PUT the bytes to that URL, then POST /cdn/upload/{assetId}/confirm.
store() returns the public cdnUrl so clients can embed it directly
without round-tripping through pylon.
Implementations§
Source§impl Stack0FileStorage
impl Stack0FileStorage
pub fn new(api_key: impl Into<String>) -> Self
pub fn with_folder(self, folder: impl Into<String>) -> Self
Sourcepub fn with_base_url(self, base_url: impl Into<String>) -> Self
pub fn with_base_url(self, base_url: impl Into<String>) -> Self
Override the API base URL (useful for tests or self-hosted Stack0).
Trait Implementations§
Source§impl FileStorage for Stack0FileStorage
impl FileStorage for Stack0FileStorage
Source§fn store(
&self,
name: &str,
content: &[u8],
content_type: &str,
) -> Result<StoredFile, FileStorageError>
fn store( &self, name: &str, content: &[u8], content_type: &str, ) -> Result<StoredFile, FileStorageError>
Store file content, returning a file ID and public URL.
Source§fn presigned_upload_url(
&self,
_name: &str,
_content_type: &str,
_expires_secs: u64,
) -> Result<Option<String>, FileStorageError>
fn presigned_upload_url( &self, _name: &str, _content_type: &str, _expires_secs: u64, ) -> Result<Option<String>, FileStorageError>
Generate a presigned upload URL (for direct client uploads).
Not all backends support this — returns None if unsupported.
Auto Trait Implementations§
impl Freeze for Stack0FileStorage
impl RefUnwindSafe for Stack0FileStorage
impl Send for Stack0FileStorage
impl Sync for Stack0FileStorage
impl Unpin for Stack0FileStorage
impl UnsafeUnpin for Stack0FileStorage
impl UnwindSafe for Stack0FileStorage
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