Enum sequoia_openpgp::types::DataFormat
source · [−]#[non_exhaustive]
pub enum DataFormat {
Binary,
Text,
Unicode,
MIME,
Unknown(char),
}
Expand description
Describes the format of the body of a literal data packet.
See the description of literal data packets Section 5.9 of RFC 4880.
Note: This enum cannot be exhaustively matched to allow future extensions.
Examples
Construct a new Message
containing one text literal packet:
use sequoia_openpgp as openpgp;
use std::convert::TryFrom;
use openpgp::packet::prelude::*;
use openpgp::types::DataFormat;
use openpgp::message::Message;
let mut packets = Vec::new();
let mut lit = Literal::new(DataFormat::Text);
lit.set_body(b"data".to_vec());
packets.push(lit.into());
let message = Message::try_from(packets);
assert!(message.is_ok(), "{:?}", message);
Variants (Non-exhaustive)
This enum is marked as non-exhaustive
Binary
Binary data.
This is a hint that the content is probably binary data.
Text
Text data.
This is a hint that the content is probably text; the encoding is not specified.
Unicode
Text data, probably valid UTF-8.
This is a hint that the content is probably UTF-8 encoded.
MIME
Do not use as semantics are unclear
MIME message.
This is defined in Section 5.10 of RFC4880bis.
Unknown(char)
Unknown format specifier.
Implementations
sourceimpl DataFormat
impl DataFormat
sourcepub fn variants() -> impl Iterator<Item = Self>
pub fn variants() -> impl Iterator<Item = Self>
Returns an iterator over all valid variants.
Returns an iterator over all known variants. This does not
include the DataFormat::Unknown
variants.
Trait Implementations
sourceimpl Clone for DataFormat
impl Clone for DataFormat
sourcefn clone(&self) -> DataFormat
fn clone(&self) -> DataFormat
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for DataFormat
impl Debug for DataFormat
sourceimpl Default for DataFormat
impl Default for DataFormat
sourceimpl Display for DataFormat
impl Display for DataFormat
sourceimpl From<DataFormat> for u8
impl From<DataFormat> for u8
sourcefn from(f: DataFormat) -> u8
fn from(f: DataFormat) -> u8
Converts to this type from the input type.
sourceimpl From<DataFormat> for char
impl From<DataFormat> for char
sourcefn from(f: DataFormat) -> char
fn from(f: DataFormat) -> char
Converts to this type from the input type.
sourceimpl From<char> for DataFormat
impl From<char> for DataFormat
sourceimpl From<u8> for DataFormat
impl From<u8> for DataFormat
sourceimpl Hash for DataFormat
impl Hash for DataFormat
sourceimpl Ord for DataFormat
impl Ord for DataFormat
sourceimpl PartialEq<DataFormat> for DataFormat
impl PartialEq<DataFormat> for DataFormat
sourcefn eq(&self, other: &DataFormat) -> bool
fn eq(&self, other: &DataFormat) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &DataFormat) -> bool
fn ne(&self, other: &DataFormat) -> bool
This method tests for !=
.
sourceimpl PartialOrd<DataFormat> for DataFormat
impl PartialOrd<DataFormat> for DataFormat
sourcefn partial_cmp(&self, other: &DataFormat) -> Option<Ordering>
fn partial_cmp(&self, other: &DataFormat) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
impl Copy for DataFormat
impl Eq for DataFormat
impl StructuralEq for DataFormat
impl StructuralPartialEq for DataFormat
Auto Trait Implementations
impl RefUnwindSafe for DataFormat
impl Send for DataFormat
impl Sync for DataFormat
impl Unpin for DataFormat
impl UnwindSafe for DataFormat
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