[−][src]Struct tinyvec_string::arraystring::CapacityOverflowError
An error was caused converting another string type into an ArrayString.
This type contains the amount by which the capacity was overflown, and the input string (when possible).
Examples
use std::convert::TryFrom; let result = ArrayString::<[u8; 3]>::try_from("foobar"); assert!(result.is_err()); let err: CapacityOverflowError<&str> = result.unwrap_err(); assert_eq!(err.overflow_amount(), 3); assert_eq!(err.into_inner(), "foobar");
Implementations
impl<S> CapacityOverflowError<S>[src]
pub fn overflow_amount(&self) -> usize[src]
Get the amount by which the capacity was overflown, i.e. the amount of extra capacity that would've been needed to store the string.
pub fn into_inner(self) -> S[src]
Retrieve the input string.
Examples
This could be used to retrieve a String that failed to convert:
use std::convert::TryFrom; let heap_string = String::from("a very long string"); let result = ArrayString::<[u8; 5]>::try_from(heap_string); assert!(result.is_err()); let err: CapacityOverflowError<String> = result.unwrap_err(); let return_of_the_heap_string = err.into_inner(); assert_eq!(return_of_the_heap_string, String::from("a very long string"));
Trait Implementations
impl<S: Clone> Clone for CapacityOverflowError<S>[src]
fn clone(&self) -> CapacityOverflowError<S>[src]
fn clone_from(&mut self, source: &Self)1.0.0[src]
impl<S: Copy> Copy for CapacityOverflowError<S>[src]
impl<S: Debug> Debug for CapacityOverflowError<S>[src]
impl<S: Display> Display for CapacityOverflowError<S>[src]
impl<S: Eq> Eq for CapacityOverflowError<S>[src]
impl<S: Ord> Ord for CapacityOverflowError<S>[src]
fn cmp(&self, other: &CapacityOverflowError<S>) -> Ordering[src]
#[must_use]fn max(self, other: Self) -> Self1.21.0[src]
#[must_use]fn min(self, other: Self) -> Self1.21.0[src]
#[must_use]fn clamp(self, min: Self, max: Self) -> Self[src]
impl<S: PartialEq> PartialEq<CapacityOverflowError<S>> for CapacityOverflowError<S>[src]
fn eq(&self, other: &CapacityOverflowError<S>) -> bool[src]
fn ne(&self, other: &CapacityOverflowError<S>) -> bool[src]
impl<S: PartialOrd> PartialOrd<CapacityOverflowError<S>> for CapacityOverflowError<S>[src]
fn partial_cmp(&self, other: &CapacityOverflowError<S>) -> Option<Ordering>[src]
fn lt(&self, other: &CapacityOverflowError<S>) -> bool[src]
fn le(&self, other: &CapacityOverflowError<S>) -> bool[src]
fn gt(&self, other: &CapacityOverflowError<S>) -> bool[src]
fn ge(&self, other: &CapacityOverflowError<S>) -> bool[src]
impl<S> StructuralEq for CapacityOverflowError<S>[src]
impl<S> StructuralPartialEq for CapacityOverflowError<S>[src]
Auto Trait Implementations
impl<S> RefUnwindSafe for CapacityOverflowError<S> where
S: RefUnwindSafe,
S: RefUnwindSafe,
impl<S> Send for CapacityOverflowError<S> where
S: Send,
S: Send,
impl<S> Sync for CapacityOverflowError<S> where
S: Sync,
S: Sync,
impl<S> Unpin for CapacityOverflowError<S> where
S: Unpin,
S: Unpin,
impl<S> UnwindSafe for CapacityOverflowError<S> where
S: UnwindSafe,
S: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone, [src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T[src]
fn clone_into(&self, target: &mut T)[src]
impl<T> ToString for T where
T: Display + ?Sized, [src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,