[][src]Enum anachro_icd::ManagedString

pub enum ManagedString<'a, T> where
    T: ArrayLength<u8>, 
{ Owned(String<T>), Borrow(&'a str), }

A borrowed or owned string

Basically like CoW, but with heapless::String

Variants

Owned(String<T>)
Borrow(&'a str)

Implementations

impl<'a, T> ManagedString<'a, T> where
    T: ArrayLength<u8>, 
[src]

pub fn as_str(&self) -> &str[src]

Obtain self as a string slice

pub fn as_borrowed(&'a self) -> ManagedString<'a, T>[src]

Retrieve a borrowed copy of the string

pub fn try_from_str(input: &str) -> Result<ManagedString<'static, T>, ()>[src]

Attempt to create an Owned string from a given str

May fail if the heapless::String is not large enough to contain this slice

pub fn borrow_from_str(input: &str) -> ManagedString<'_, T>[src]

Create a Borrowed string from a given str

pub fn try_to_owned(&self) -> Result<ManagedString<'static, T>, ()>[src]

Attempt to convert to an Owned string from the current state

May fail if the heapless::String is not large enough to contain this slice

Trait Implementations

impl<'a, T: Clone> Clone for ManagedString<'a, T> where
    T: ArrayLength<u8>, 
[src]

impl<'a, T: Debug> Debug for ManagedString<'a, T> where
    T: ArrayLength<u8>, 
[src]

impl<'a, 'de: 'a, T> Deserialize<'de> for ManagedString<'a, T> where
    T: ArrayLength<u8> + Sized
[src]

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where
    D: Deserializer<'de>, 
[src]

We can deserialize as a borrowed str

impl<'a, T: Eq> Eq for ManagedString<'a, T> where
    T: ArrayLength<u8>, 
[src]

impl<'a, T: PartialEq> PartialEq<ManagedString<'a, T>> for ManagedString<'a, T> where
    T: ArrayLength<u8>, 
[src]

impl<'a, T> Serialize for ManagedString<'a, T> where
    T: ArrayLength<u8>, 
[src]

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

We can serialize our managed string as a str

impl<'a, T> StructuralEq for ManagedString<'a, T> where
    T: ArrayLength<u8>, 
[src]

impl<'a, T> StructuralPartialEq for ManagedString<'a, T> where
    T: ArrayLength<u8>, 
[src]

Auto Trait Implementations

impl<'a, T> Send for ManagedString<'a, T>

impl<'a, T> Sync for ManagedString<'a, T>

impl<'a, T> Unpin for ManagedString<'a, T> where
    <T as ArrayLength<u8>>::ArrayType: Unpin

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

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

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.