pub struct MsgType { /* private fields */ }Expand description
Compact, Copy newtype wrapping a validated MsgType raw value: 1-2 ASCII
alphanumeric bytes, stored inline.
Borrow<[u8]> yields only the live bytes, so a HashMap<MsgTypeField, _>
can be looked up by a &[u8] slice without allocating.
Implementations§
Source§impl MsgTypeField
impl MsgTypeField
Sourcepub const fn from_bytes(bytes: &[u8]) -> Result<MsgTypeField, MsgTypeError>
pub const fn from_bytes(bytes: &[u8]) -> Result<MsgTypeField, MsgTypeError>
Validate 1-2 ASCII alphanumeric bytes as a MsgType value.
§Errors
MsgTypeError::Empty for no bytes, MsgTypeError::TooLong for
more than two, MsgTypeError::InvalidChar for anything outside
0-9, a-z, A-Z.
Sourcepub const fn as_str(&self) -> &str
pub const fn as_str(&self) -> &str
The live bytes as &str. Infallible - the validated bytes are ASCII.
Sourcepub const fn as_fix_str(&self) -> &FixStr
pub const fn as_fix_str(&self) -> &FixStr
The live bytes as &FixStr. Infallible - the validated bytes are
within the printable-ASCII range FixStr requires.
Trait Implementations§
Source§impl Borrow<[u8]> for MsgTypeField
impl Borrow<[u8]> for MsgTypeField
Source§impl Clone for MsgTypeField
impl Clone for MsgTypeField
Source§fn clone(&self) -> MsgTypeField
fn clone(&self) -> MsgTypeField
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for MsgTypeField
Source§impl Debug for MsgTypeField
impl Debug for MsgTypeField
Source§impl<'de> Deserialize<'de> for MsgTypeField
Available on crate feature serde-deserialize only.
impl<'de> Deserialize<'de> for MsgTypeField
Available on crate feature
serde-deserialize only.Source§fn deserialize<D>(
deserializer: D,
) -> Result<MsgTypeField, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<MsgTypeField, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for MsgTypeField
impl Display for MsgTypeField
impl Eq for MsgTypeField
Source§impl<T> From<T> for MsgTypeFieldwhere
T: MsgTypeValue,
impl<T> From<T> for MsgTypeFieldwhere
T: MsgTypeValue,
Source§fn from(v: T) -> MsgTypeField
fn from(v: T) -> MsgTypeField
Converts to this type from the input type.
Source§impl FromStr for MsgTypeField
impl FromStr for MsgTypeField
Source§type Err = MsgTypeError
type Err = MsgTypeError
The associated error which can be returned from parsing.
Source§fn from_str(s: &str) -> Result<MsgTypeField, <MsgTypeField as FromStr>::Err>
fn from_str(s: &str) -> Result<MsgTypeField, <MsgTypeField as FromStr>::Err>
Parses a string
s to return a value of this type. Read moreSource§impl Hash for MsgTypeField
impl Hash for MsgTypeField
Source§impl PartialEq for MsgTypeField
impl PartialEq for MsgTypeField
Source§impl PartialEq<MsgTypeBase> for MsgTypeField
impl PartialEq<MsgTypeBase> for MsgTypeField
Source§impl Serialize for MsgTypeField
Available on crate feature serde-serialize only.
impl Serialize for MsgTypeField
Available on crate feature
serde-serialize only.Source§fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl StructuralPartialEq for MsgTypeField
Auto Trait Implementations§
impl Forget for MsgTypeField
impl Freeze for MsgTypeField
impl RefUnwindSafe for MsgTypeField
impl Send for MsgTypeField
impl Sync for MsgTypeField
impl Unpin for MsgTypeField
impl UnsafeUnpin for MsgTypeField
impl UnwindSafe for MsgTypeField
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