pub struct FixString(/* private fields */);Implementations§
Source§impl FixString
impl FixString
Sourcepub const fn new() -> FixString
pub const fn new() -> FixString
Creates an empty FixString - a “not yet set” placeholder, not a
valid field value.
Every FIX field must carry at least one byte, so an empty value
never reaches the wire: serializing it fails with
SerializeError::EmptyValue. Use it where a Default or a const
starting value is needed; to express a genuinely absent value, use
Option<FixString> instead.
Sourcepub fn from_ascii(buf: Vec<u8>) -> Result<FixString, FixStringError>
pub fn from_ascii(buf: Vec<u8>) -> Result<FixString, FixStringError>
Converts a vector of bytes to a FixString.
A FixString requires printable ASCII (0x20-0x7e); from_ascii
checks every byte and then takes ownership of the vector without
copying it. To skip the check see from_ascii_unchecked; for a
borrowed result see FixStr::from_ascii. The inverse is
into_bytes.
§Errors
Returns Err if any byte is outside printable ASCII, reporting its
index and value.
Sourcepub unsafe fn from_ascii_unchecked(buf: Vec<u8>) -> FixString
pub unsafe fn from_ascii_unchecked(buf: Vec<u8>) -> FixString
Converts a vector of bytes to a FixString without checking it.
See the safe version, from_ascii, for more details.
§Safety
Every byte passed in must be printable ASCII (0x20-0x7e).
Violating this is undefined behavior: the rest of the library relies
on the invariant, including as_utf8, which skips UTF-8 validation.
Sourcepub fn from_ascii_lossy(buf: Vec<u8>) -> FixString
pub fn from_ascii_lossy(buf: Vec<u8>) -> FixString
Converts a slice of bytes to a FixString, replacing invalid
characters by ?.
pub fn as_utf8(&self) -> &str
pub fn into_utf8(self) -> String
pub fn into_bytes(self) -> Vec<u8> ⓘ
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Trait Implementations§
Source§impl Default for FixString
Returns an empty FixString, equivalent to FixString::new - a
“not yet set” placeholder, not a valid field value.
impl Default for FixString
Returns an empty FixString, equivalent to FixString::new - a
“not yet set” placeholder, not a valid field value.
Source§impl<'de> Deserialize<'de> for FixString
impl<'de> Deserialize<'de> for FixString
Source§fn deserialize<D>(
deserializer: D,
) -> Result<FixString, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<FixString, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
impl Eq for FixString
Source§impl Ord for FixString
impl Ord for FixString
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialOrd for FixString
impl PartialOrd for FixString
Source§impl Serialize for FixString
Available on crate feature serde-serialize only.
impl Serialize for FixString
serde-serialize only.