Skip to content

Struct Attachment

zaun_client::Attachment · Struct

pub struct Attachment { … }

A file on a message.

pub const fn id(&self) -> AttachmentId

Its id.

pub fn name(&self) -> &str

Its name (empty when the cache does not have it).

pub const fn size(&self) -> u64

Its size in bytes.

pub fn content_type(&self) -> &str

Its media type.

pub const fn data(&self) -> &AttachmentData

The attachment as the protocol describes it.

pub const fn message(&self) -> &Message

The message it is on.

pub fn download<impl AsRef<Path>>(&self, dest: impl AsRef<Path>) -> Result<PathBuf>

Downloads the file into the folder dest under a safe name and answers its path, once its size and SHA3-256 match.

The host refused, the transfer failed or timed out, or the file does not match.

Clone, Debug, From<&Attachment>

Full rustdoc page