Struct easyfix_messages::fields::FixString

source ·
pub struct FixString(/* private fields */);

Implementations§

source§

impl FixString

source

pub const fn new() -> FixString

source

pub fn with_capacity(capacity: usize) -> FixString

source

pub fn from_ascii(buf: Vec<u8>) -> Result<FixString, FixStringError>

Converts a vector of bytes to a FixString.

A FIX string (FixString) is made of bytes (u8), and a vector of bytes (Vec<u8>) is made of bytes, so this function converts between the two. Not all byte slices are valid FixStrings, however: FixString requires that it is valid ASCII. from_ascii() checks to ensure that the bytes are valid ASCII, and then does the conversion.

If you are sure that the byte slice is valid ASCII, and you don’t want to incur the overhead of the validity check, there is an unsafe version of this function, from_ascii_unchecked, which has the same behavior but skips the check.

This method will take care to not copy the vector, for efficiency’s sake.

If you need a &FixStr instead of a FixString, consider FixStr::from_ascii.

The inverse of this method is into_bytes.

§Errors

Returns Err if the slice is not ASCII with a description as to why the provided bytes are not ASCII.

source

pub unsafe fn from_ascii_unchecked(buf: Vec<u8>) -> FixString

Converts a vector of bytes to a FixString without checking that the it contains only ASCII characters.

See the safe version, from_ascii, for more details.

§Safety

This function is unsafe because it does not check that the bytes passed to it are valid ASCII. If this constraint is violated, it may cause memory unsafety issues with future users of the FixString, as the rest of the library assumes that FixStrings are valid ASCII.

source

pub fn from_ascii_lossy(buf: Vec<u8>) -> FixString

Converts a slice of bytes to a FixString, replacing invalid characters by ?.

source

pub fn as_utf8(&self) -> &str

source

pub fn into_utf8(self) -> String

source

pub fn into_bytes(self) -> Vec<u8>

source

pub fn len(&self) -> usize

source

pub fn is_empty(&self) -> bool

Methods from Deref<Target = FixStr>§

source

pub fn as_utf8(&self) -> &str

source

pub fn as_bytes(&self) -> &[u8]

source

pub fn len(&self) -> usize

source

pub fn is_empty(&self) -> bool

Trait Implementations§

source§

impl AsRef<[u8]> for FixString

source§

fn as_ref(&self) -> &[u8]

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl AsRef<FixStr> for FixString

source§

fn as_ref(&self) -> &FixStr

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl AsRef<str> for FixString

source§

fn as_ref(&self) -> &str

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl Borrow<FixStr> for FixString

source§

fn borrow(&self) -> &FixStr

Immutably borrows from an owned value. Read more
source§

impl Clone for FixString

source§

fn clone(&self) -> FixString

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for FixString

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for FixString

source§

fn default() -> FixString

Returns the “default value” for a type. Read more
source§

impl Deref for FixString

§

type Target = FixStr

The resulting type after dereferencing.
source§

fn deref(&self) -> &FixStr

Dereferences the value.
source§

impl<'de> Deserialize<'de> for FixString

source§

fn deserialize<D>(deserializer: D) -> Result<FixString, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl Display for FixString

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl<const N: usize> From<&[u8; N]> for FixString

source§

fn from(input: &[u8; N]) -> FixString

Converts to this type from the input type.
source§

impl From<&FixStr> for FixString

source§

fn from(input: &FixStr) -> FixString

Converts to this type from the input type.
source§

impl From<FixString> for String

source§

fn from(input: FixString) -> String

Converts to this type from the input type.
source§

impl Hash for FixString

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl Ord for FixString

source§

fn cmp(&self, other: &FixString) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized + PartialOrd,

Restrict a value to a certain interval. Read more
source§

impl PartialEq<&[u8]> for FixString

source§

fn eq(&self, other: &&[u8]) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<const N: usize> PartialEq<&[u8; N]> for FixString

source§

fn eq(&self, other: &&[u8; N]) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<&FixStr> for FixString

source§

fn eq(&self, other: &&FixStr) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<&str> for FixString

source§

fn eq(&self, other: &&str) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<[u8]> for FixString

source§

fn eq(&self, other: &[u8]) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<const N: usize> PartialEq<[u8; N]> for FixString

source§

fn eq(&self, other: &[u8; N]) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<FixStr> for FixString

source§

fn eq(&self, other: &FixStr) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<String> for FixString

source§

fn eq(&self, other: &String) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<Vec<u8>> for FixString

source§

fn eq(&self, other: &Vec<u8>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<str> for FixString

source§

fn eq(&self, other: &str) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq for FixString

source§

fn eq(&self, other: &FixString) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd for FixString

source§

fn partial_cmp(&self, other: &FixString) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

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 more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl Serialize for FixString

source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl TryFrom<&[u8]> for FixString

§

type Error = FixStringError

The type returned in the event of a conversion error.
source§

fn try_from(input: &[u8]) -> Result<FixString, Self::Error>

Performs the conversion.
source§

impl TryFrom<&str> for FixString

§

type Error = FixStringError

The type returned in the event of a conversion error.
source§

fn try_from(buf: &str) -> Result<FixString, Self::Error>

Performs the conversion.
source§

impl<const N: usize> TryFrom<[u8; N]> for FixString

§

type Error = FixStringError

The type returned in the event of a conversion error.
source§

fn try_from(buf: [u8; N]) -> Result<FixString, Self::Error>

Performs the conversion.
source§

impl TryFrom<String> for FixString

§

type Error = FixStringError

The type returned in the event of a conversion error.
source§

fn try_from(buf: String) -> Result<FixString, Self::Error>

Performs the conversion.
source§

impl TryFrom<Vec<u8>> for FixString

§

type Error = FixStringError

The type returned in the event of a conversion error.
source§

fn try_from(buf: Vec<u8>) -> Result<FixString, Self::Error>

Performs the conversion.
source§

impl Eq for FixString

source§

impl StructuralPartialEq for FixString

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,