pub struct ContentUpload<S> {
pub content_id: String,
pub uploaded_bytes: u64,
pub total_bytes: u64,
pub cid: Option<String>,
/* private fields */
}Expand description
Type-safe content upload with state machine enforcement.
Fields§
§content_id: StringContent identifier
uploaded_bytes: u64Upload progress (bytes)
total_bytes: u64Total size (bytes)
cid: Option<String>CID (only set in Published state)
Implementations§
Source§impl ContentUpload<Uploading>
impl ContentUpload<Uploading>
Sourcepub fn new(content_id: impl Into<String>, total_bytes: u64) -> Self
pub fn new(content_id: impl Into<String>, total_bytes: u64) -> Self
Create a new content upload.
Sourcepub fn update_progress(&mut self, bytes: u64)
pub fn update_progress(&mut self, bytes: u64)
Update upload progress.
Sourcepub fn is_complete(&self) -> bool
pub fn is_complete(&self) -> bool
Check if upload is complete.
Sourcepub fn complete_upload(self) -> ContentUpload<Processing>
pub fn complete_upload(self) -> ContentUpload<Processing>
Transition to Processing state when upload completes.
Source§impl ContentUpload<Archived>
impl ContentUpload<Archived>
Sourcepub fn archived_cid(&self) -> &str
pub fn archived_cid(&self) -> &str
Get the archived content CID.
Trait Implementations§
Source§impl<S: Clone> Clone for ContentUpload<S>
impl<S: Clone> Clone for ContentUpload<S>
Source§fn clone(&self) -> ContentUpload<S>
fn clone(&self) -> ContentUpload<S>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl<S> Freeze for ContentUpload<S>
impl<S> RefUnwindSafe for ContentUpload<S>where
S: RefUnwindSafe,
impl<S> Send for ContentUpload<S>where
S: Send,
impl<S> Sync for ContentUpload<S>where
S: Sync,
impl<S> Unpin for ContentUpload<S>where
S: Unpin,
impl<S> UnwindSafe for ContentUpload<S>where
S: UnwindSafe,
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