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.
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.
Returns the Owned
value if self
is Owned
.
Panics if self
is Borrowed
.
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 if self
is Owned
.
use rocket::data::Transform;
let borrowed: Transform<usize, &[usize]> = Transform::Borrowed(&[10]);
assert_eq!(borrowed.borrowed(), &[10]);
impl<T> Any for T where
T: 'static + ?Sized,
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
impl<T, U> Into<U> for T where
U: From<T>,
Converts self
into a collection.
The type returned in the event of a conversion error.
The type returned in the event of a conversion error.
Get the TypeId
of this object.