[][src]Struct datetime_string::ConversionError

pub struct ConversionError<T> { /* fields omitted */ }

Error with value before conversion.

Implementations

impl<T> ConversionError<T>[src]

#[must_use]pub fn error(&self) -> Error[src]

Returns the inner (validation) error.

Examples

// `rfc3339::FullTimeString` is only available when `alloc` feature is enabled.
#![cfg(feature = "alloc")]

use std::convert::TryFrom;
use datetime_string::{Error, rfc3339::FullTimeString};

let conv_err = FullTimeString::try_from("invalid time".to_owned()).unwrap_err();
let _: Error = conv_err.error();

#[must_use]pub fn value(&self) -> &T[src]

Returns a reference to the value, which is failed to convert.

Examples

// `rfc3339::FullTimeString` is only available when `alloc` feature is enabled.
#![cfg(feature = "alloc")]

use std::convert::TryFrom;
use datetime_string::{Error, rfc3339::FullTimeString};

let conv_err = FullTimeString::try_from("invalid time".to_owned()).unwrap_err();
let source_val: &String = conv_err.value();
assert_eq!(source_val, "invalid time");

#[must_use]pub fn into_value(self) -> T[src]

Returns the value, which is failed to convert.

Examples

// `rfc3339::FullTimeString` is only available when `alloc` feature is enabled.
#![cfg(feature = "alloc")]

use std::convert::TryFrom;
use datetime_string::{Error, rfc3339::FullTimeString};

let conv_err = FullTimeString::try_from("invalid time".to_owned()).unwrap_err();
let source_val: String = conv_err.into_value();
assert_eq!(source_val, "invalid time");

Trait Implementations

impl<T: Clone> Clone for ConversionError<T>[src]

impl<T: Debug> Debug for ConversionError<T>[src]

impl<T: Debug> Display for ConversionError<T>[src]

impl<T: Debug> Error for ConversionError<T>[src]

Auto Trait Implementations

impl<T> RefUnwindSafe for ConversionError<T> where
    T: RefUnwindSafe

impl<T> Send for ConversionError<T> where
    T: Send

impl<T> Sync for ConversionError<T> where
    T: Sync

impl<T> Unpin for ConversionError<T> where
    T: Unpin

impl<T> UnwindSafe for ConversionError<T> where
    T: UnwindSafe

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> From<T> for T[src]

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

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

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.