#[non_exhaustive]pub enum DataFormat {
Binary,
Unicode,
Text,
Unknown(u8),
}
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 9580.
§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::Unicode);
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.
Unicode
Text data, probably valid UTF-8.
This is a hint that the content is probably UTF-8 encoded.
Text
👎Deprecated: Use Dataformat::Unicode instead.
Text data.
This is a hint that the content is probably text; the encoding is not specified.
Unknown(u8)
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 duplicate of the value. Read more
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const 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 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<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§impl PartialOrd for DataFormat
impl PartialOrd for DataFormat
impl 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