[−][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]
pub fn clone(&self) -> CapacityOverflowError<S>
[src]
pub 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]
pub fn cmp(&self, other: &CapacityOverflowError<S>) -> Ordering
[src]
#[must_use]pub fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn clamp(self, min: Self, max: Self) -> Self
1.50.0[src]
impl<S: PartialEq> PartialEq<CapacityOverflowError<S>> for CapacityOverflowError<S>
[src]
pub fn eq(&self, other: &CapacityOverflowError<S>) -> bool
[src]
pub fn ne(&self, other: &CapacityOverflowError<S>) -> bool
[src]
impl<S: PartialOrd> PartialOrd<CapacityOverflowError<S>> for CapacityOverflowError<S>
[src]
pub fn partial_cmp(&self, other: &CapacityOverflowError<S>) -> Option<Ordering>
[src]
pub fn lt(&self, other: &CapacityOverflowError<S>) -> bool
[src]
pub fn le(&self, other: &CapacityOverflowError<S>) -> bool
[src]
pub fn gt(&self, other: &CapacityOverflowError<S>) -> bool
[src]
pub 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,
[src]
S: RefUnwindSafe,
impl<S> Send for CapacityOverflowError<S> where
S: Send,
[src]
S: Send,
impl<S> Sync for CapacityOverflowError<S> where
S: Sync,
[src]
S: Sync,
impl<S> Unpin for CapacityOverflowError<S> where
S: Unpin,
[src]
S: Unpin,
impl<S> UnwindSafe for CapacityOverflowError<S> where
S: UnwindSafe,
[src]
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,
pub 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.
pub fn to_owned(&self) -> T
[src]
pub 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.
pub 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>,