[][src]Enum rocket::data::Transform

pub enum Transform<T, B = T> {
    Owned(T),
    Borrowed(B),
}

Indicates how incoming data should be transformed before being parsed and validated by a data guard.

See the documentation for FromData for usage details.

Variants

Indicates that data should be or has been transformed into the FromData::Owned variant.

Indicates that data should be or has been transformed into the FromData::Borrowed variant.

Methods

impl<T, B> Transform<T, B>
[src]

Returns the Owned value if self is Owned.

Panics

Panics if self is Borrowed.

Example

use rocket::data::Transform;

let owned: Transform<usize, &[usize]> = Transform::Owned(10);
assert_eq!(owned.owned(), 10);

Returns the Borrowed value if self is Borrowed.

Panics

Panics if self is Owned.

use rocket::data::Transform;

let borrowed: Transform<usize, &[usize]> = Transform::Borrowed(&[10]);
assert_eq!(borrowed.borrowed(), &[10]);

Auto Trait Implementations

impl<T, B> Send for Transform<T, B> where
    B: Send,
    T: Send

impl<T, B> Sync for Transform<T, B> where
    B: Sync,
    T: Sync

Blanket Implementations

impl<T> From for T
[src]

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

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

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

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

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

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

impl<T> Typeable for T where
    T: Any

Get the TypeId of this object.

impl<T> IntoCollection for T

impl<T, I> AsResult for T where
    I: Input,