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
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
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
👎Deprecated since 1.10.0: Do not use as semantics are unclear
MIME message.
This is defined in Section 5.10 of RFC4880bis.
Unknown(char)
Unknown format specifier.
Implementations§
source§impl 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§
source§impl Clone for DataFormat
impl Clone for DataFormat
source§fn clone(&self) -> DataFormat
fn clone(&self) -> DataFormat
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for DataFormat
impl Debug for DataFormat
source§impl Default for DataFormat
impl Default for DataFormat
source§impl Display for DataFormat
impl Display for DataFormat
source§impl From<DataFormat> for char
impl From<DataFormat> for char
source§fn from(f: DataFormat) -> char
fn from(f: DataFormat) -> char
Converts to this type from the input type.
source§impl From<DataFormat> for u8
impl From<DataFormat> for u8
source§fn from(f: DataFormat) -> u8
fn from(f: DataFormat) -> u8
Converts to this type from the input type.
source§impl From<char> for DataFormat
impl From<char> for DataFormat
source§impl From<u8> for DataFormat
impl From<u8> for DataFormat
source§impl Hash for DataFormat
impl Hash for DataFormat
source§impl Ord for DataFormat
impl Ord for DataFormat
source§fn cmp(&self, other: &DataFormat) -> Ordering
fn cmp(&self, other: &DataFormat) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
source§impl PartialEq for DataFormat
impl PartialEq for DataFormat
source§fn 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 ==
.source§impl PartialOrd for DataFormat
impl PartialOrd for DataFormat
source§fn partial_cmp(&self, other: &DataFormat) -> Option<Ordering>
fn partial_cmp(&self, other: &DataFormat) -> Option<Ordering>
1.0.0 · source§fn 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 moreimpl Copy for DataFormat
impl Eq for DataFormat
impl StructuralPartialEq for DataFormat
Auto Trait Implementations§
impl Freeze for DataFormat
impl RefUnwindSafe for DataFormat
impl Send for DataFormat
impl Sync for DataFormat
impl Unpin for DataFormat
impl UnwindSafe for DataFormat
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
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<T> CloneToUninit for Twhere
T: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)