Struct sequoia_openpgp::packet::Literal
source · [−]pub struct Literal { /* private fields */ }
Expand description
Holds a literal packet.
A literal packet contains unstructured data. Since the size can
be very large, it is advised to process messages containing such
packets using a PacketParser
or a PacketPileParser
and process
the data in a streaming manner rather than the using the
PacketPile::from_file
and related interfaces.
See Section 5.9 of RFC 4880 for details.
Implementations
sourceimpl Literal
impl Literal
sourcepub fn new(format: DataFormat) -> Literal
pub fn new(format: DataFormat) -> Literal
Returns a new Literal
packet.
sourcepub fn format(&self) -> DataFormat
pub fn format(&self) -> DataFormat
Gets the Literal packet’s content disposition.
sourcepub fn set_format(&mut self, format: DataFormat) -> DataFormat
pub fn set_format(&mut self, format: DataFormat) -> DataFormat
Sets the Literal packet’s content disposition.
sourcepub fn filename(&self) -> Option<&[u8]>
pub fn filename(&self) -> Option<&[u8]>
Gets the literal packet’s filename.
Note: when a literal data packet is protected by a signature, only the literal data packet’s body is protected, not the meta-data. As such, this field should normally be ignored.
sourcepub fn set_filename<F>(&mut self, filename: F) -> Result<Option<Vec<u8>>> where
F: AsRef<[u8]>,
pub fn set_filename<F>(&mut self, filename: F) -> Result<Option<Vec<u8>>> where
F: AsRef<[u8]>,
Sets the literal packet’s filename field.
The standard does not specify the encoding. Filenames must not be longer than 255 bytes.
Note: when a literal data packet is protected by a signature, only the literal data packet’s body is protected, not the meta-data. As such, this field should not be used.
sourcepub fn date(&self) -> Option<SystemTime>
pub fn date(&self) -> Option<SystemTime>
Gets the literal packet’s date field.
Note: when a literal data packet is protected by a signature, only the literal data packet’s body is protected, not the meta-data. As such, this field should normally be ignored.
sourcepub fn set_date<T>(&mut self, timestamp: T) -> Result<Option<SystemTime>> where
T: Into<Option<SystemTime>>,
pub fn set_date<T>(&mut self, timestamp: T) -> Result<Option<SystemTime>> where
T: Into<Option<SystemTime>>,
Sets the literal packet’s date field.
Note: when a literal data packet is protected by a signature, only the literal data packet’s body is protected, not the meta-data. As such, this field should not be used.
Trait Implementations
sourceimpl Any<Literal> for Packet
impl Any<Literal> for Packet
sourcefn downcast(self) -> Result<Literal, Packet>
fn downcast(self) -> Result<Literal, Packet>
Attempts to downcast to T
, returning the packet if it fails. Read more
sourcefn downcast_ref(&self) -> Option<&Literal>
fn downcast_ref(&self) -> Option<&Literal>
Attempts to downcast to &T
, returning None
if it fails. Read more
sourcefn downcast_mut(&mut self) -> Option<&mut Literal>
fn downcast_mut(&mut self) -> Option<&mut Literal>
Attempts to downcast to &mut T
, returning None
if it fails. Read more
sourceimpl IntoIterator for Literal
impl IntoIterator for Literal
Implement IntoIterator
so that
cert::insert_packets(sig)
just works.
sourceimpl MarshalInto for Literal
impl MarshalInto for Literal
sourcefn serialized_len(&self) -> usize
fn serialized_len(&self) -> usize
Computes the maximal length of the serialized representation. Read more
sourcefn serialize_into(&self, buf: &mut [u8]) -> Result<usize>
fn serialize_into(&self, buf: &mut [u8]) -> Result<usize>
Serializes into the given buffer. Read more
sourceimpl<'a> Parse<'a, Literal> for Literal
impl<'a> Parse<'a, Literal> for Literal
impl Eq for Literal
impl StructuralEq for Literal
impl StructuralPartialEq for Literal
Auto Trait Implementations
impl RefUnwindSafe for Literal
impl Send for Literal
impl Sync for Literal
impl Unpin for Literal
impl UnwindSafe for Literal
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