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

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

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

Owned(T)

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

Tuple Fields of Owned

0: T
Borrowed(B)

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

Tuple Fields of Borrowed

0: B

Implementations

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

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

Converts self into a collection.

Should always be Self

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Get the TypeId of this object.