pub struct Attachment { /* private fields */ }Expand description
One file with stable identity, presentation metadata, and upload state.
Equality compares every field; thumbnails compare by identity so a snapshot that re-attaches the same image does not invalidate rows.
Implementations§
Source§impl Attachment
impl Attachment
Sourcepub fn new(id: impl Into<SharedString>, name: impl Into<SharedString>) -> Self
pub fn new(id: impl Into<SharedString>, name: impl Into<SharedString>) -> Self
Creates a ready attachment; the kind is inferred from the name.
Sourcepub fn kind(self, kind: AttachmentKind) -> Self
pub fn kind(self, kind: AttachmentKind) -> Self
Overrides the inferred kind.
Sourcepub fn size_bytes(self, size_bytes: u64) -> Self
pub fn size_bytes(self, size_bytes: u64) -> Self
Sets the size shown in the metadata line.
Sourcepub fn detail(self, detail: impl Into<SharedString>) -> Self
pub fn detail(self, detail: impl Into<SharedString>) -> Self
Adds a short detail such as 12 pages or 1280×720.
Sourcepub fn thumbnail(self, image: Arc<Image>) -> Self
pub fn thumbnail(self, image: Arc<Image>) -> Self
Shows an image thumbnail instead of the kind glyph.
Sourcepub fn state(self, state: ProgressState) -> Self
pub fn state(self, state: ProgressState) -> Self
Sets the upload lifecycle: pending or running files are not yet usable, failed ones carry a reason.
Sourcepub fn progress(self, fraction: f32) -> Self
pub fn progress(self, fraction: f32) -> Self
Sets the upload fraction (0.0..=1.0) shown while running.
Sourcepub fn attachment_kind(&self) -> AttachmentKind
pub fn attachment_kind(&self) -> AttachmentKind
Returns the kind used for the glyph and label.
Sourcepub fn detail_text(&self) -> Option<&SharedString>
pub fn detail_text(&self) -> Option<&SharedString>
Returns the optional detail text.
Sourcepub fn thumbnail_image(&self) -> Option<&Arc<Image>>
pub fn thumbnail_image(&self) -> Option<&Arc<Image>>
Returns the thumbnail, if any.
Sourcepub fn upload_state(&self) -> &ProgressState
pub fn upload_state(&self) -> &ProgressState
Returns the upload lifecycle.
Sourcepub fn summary(&self) -> String
pub fn summary(&self) -> String
The one-line metadata shown under the name and read to assistive technology: kind, size, detail, or the lifecycle when not ready.
Sourcepub fn accessibility_label(&self) -> String
pub fn accessibility_label(&self) -> String
The accessible name: file name plus summary.
Trait Implementations§
Source§impl Clone for Attachment
impl Clone for Attachment
Source§fn clone(&self) -> Attachment
fn clone(&self) -> Attachment
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for Attachment
impl Debug for Attachment
impl Eq for Attachment
Auto Trait Implementations§
impl Freeze for Attachment
impl RefUnwindSafe for Attachment
impl Send for Attachment
impl Sync for Attachment
impl Unpin for Attachment
impl UnsafeUnpin for Attachment
impl UnwindSafe for Attachment
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Span], returning an
Instrumented wrapper.§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘwhere
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘwhere
S: Into<Dispatch>,
Subscriber to this type, returning a
[WithDispatch] wrapper.