pub enum FormatIdentity<T> {
Classified {
dialects: T,
},
Unclassified {
format: String,
},
}Expand description
A format identity that is either classified by a typed payload or retains only its known format.
Classified state stores no second format string. The payload is the one author of its namespace, so the format is on the wire exactly once in either state.
Variants§
Classified
The payload carries the complete classified identity.
Fields
§
dialects: TClassified payload, whose namespace is the format.
Unclassified
The format is known but no classification payload exists.
Implementations§
Source§impl<T: FormatIdentityPayload> FormatIdentity<T>
impl<T: FormatIdentityPayload> FormatIdentity<T>
Sourcepub const fn classified(payload: T) -> Self
pub const fn classified(payload: T) -> Self
Constructs an identity whose format comes from its classified payload.
Sourcepub fn unclassified(format: impl Into<String>) -> Self
pub fn unclassified(format: impl Into<String>) -> Self
Constructs an identity for a known format without classification.
Sourcepub const fn classified_payload(&self) -> Option<&T>
pub const fn classified_payload(&self) -> Option<&T>
Returns the classified payload, when present.
Trait Implementations§
Source§impl<T: Clone> Clone for FormatIdentity<T>
impl<T: Clone> Clone for FormatIdentity<T>
Source§impl<T: Debug> Debug for FormatIdentity<T>
impl<T: Debug> Debug for FormatIdentity<T>
Source§impl<'de, T> Deserialize<'de> for FormatIdentity<T>where
T: Deserialize<'de>,
impl<'de, T> Deserialize<'de> for FormatIdentity<T>where
T: Deserialize<'de>,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl<T: Eq> Eq for FormatIdentity<T>
Source§impl<T: PartialEq> PartialEq for FormatIdentity<T>
impl<T: PartialEq> PartialEq for FormatIdentity<T>
Source§impl<T> Serialize for FormatIdentity<T>where
T: Serialize,
impl<T> Serialize for FormatIdentity<T>where
T: Serialize,
impl<T: PartialEq> StructuralPartialEq for FormatIdentity<T>
Auto Trait Implementations§
impl<T> Freeze for FormatIdentity<T>where
T: Freeze,
impl<T> RefUnwindSafe for FormatIdentity<T>where
T: RefUnwindSafe,
impl<T> Send for FormatIdentity<T>where
T: Send,
impl<T> Sync for FormatIdentity<T>where
T: Sync,
impl<T> Unpin for FormatIdentity<T>where
T: Unpin,
impl<T> UnsafeUnpin for FormatIdentity<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for FormatIdentity<T>where
T: UnwindSafe,
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