Struct didcomm_rs::AttachmentBuilder
source · [−]pub struct AttachmentBuilder { /* private fields */ }
Expand description
Builder of attachment metadata and payload.
Used to construct and inject Attachment into Message
Implementations
sourceimpl AttachmentBuilder
impl AttachmentBuilder
sourcepub fn new(include_mod_time: bool) -> Self
pub fn new(include_mod_time: bool) -> Self
Constructor of new instance of the builder.
Parameters
included_mod_time
-bool
value indicating if this attachment should be timestamped on attaching. Iftrue
- will updatelastmod_time
property on builder consumption.
sourcepub fn with_id(self, id: &str) -> Self
pub fn with_id(self, id: &str) -> Self
Optional, but recommended identifier of attachment content.
Parameters
id
- String ofAttachment
identifier
sourcepub fn with_description(self, description: &str) -> Self
pub fn with_description(self, description: &str) -> Self
sourcepub fn with_filename(self, filename: &str) -> Self
pub fn with_filename(self, filename: &str) -> Self
sourcepub fn with_media_type(self, media_type: &str) -> Self
pub fn with_media_type(self, media_type: &str) -> Self
Describes the media (MIME) type of the attached content
Parameters
media_type
- String of media type description
sourcepub fn with_format(self, format: &str) -> Self
pub fn with_format(self, format: &str) -> Self
Describes the format of the attachment if the media_type
is not sufficient.
Parameters
format
- String format identifier
sourcepub fn external_size(self, bytes: usize) -> Self
pub fn external_size(self, bytes: usize) -> Self
mostly relevant when content is included by reference instead of by value. Lets the receiver guess how expensive it will be, in time, bandwidth, and storage, to fully fetch the attachment.
Parameters
bytes
- usize of bytes.
sourcepub fn with_data(self, attachment_data: AttachmentDataBuilder) -> Self
pub fn with_data(self, attachment_data: AttachmentDataBuilder) -> Self
Attach actual payload in form of AttachmentData
Consumes AttachmentDataBuilder
to do so.
Parameters
attachment_data
- ‘AttachmentDataBuilder’ instance, prepopulated.
Auto Trait Implementations
impl RefUnwindSafe for AttachmentBuilder
impl Send for AttachmentBuilder
impl Sync for AttachmentBuilder
impl Unpin for AttachmentBuilder
impl UnwindSafe for AttachmentBuilder
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more