pub struct Transformation<T> { /* private fields */ }Expand description
A data object or collection with the partials, additional data and wrap of one
transformation: what PHP’s include(), additional() and wrap() return.
Implementations§
Source§impl<T: Serialize> Transformation<T>
impl<T: Serialize> Transformation<T>
Sourcepub fn include<S: AsRef<str>>(self, paths: impl IntoIterator<Item = S>) -> Self
pub fn include<S: AsRef<str>>(self, paths: impl IntoIterator<Item = S>) -> Self
Includes lazy properties: include('songs', 'songs.{name, artist}').
Sourcepub fn exclude<S: AsRef<str>>(self, paths: impl IntoIterator<Item = S>) -> Self
pub fn exclude<S: AsRef<str>>(self, paths: impl IntoIterator<Item = S>) -> Self
Excludes lazy properties included by default: exclude().
Sourcepub fn only<S: AsRef<str>>(self, paths: impl IntoIterator<Item = S>) -> Self
pub fn only<S: AsRef<str>>(self, paths: impl IntoIterator<Item = S>) -> Self
Keeps only these properties: only().
Sourcepub fn except<S: AsRef<str>>(self, paths: impl IntoIterator<Item = S>) -> Self
pub fn except<S: AsRef<str>>(self, paths: impl IntoIterator<Item = S>) -> Self
Leaves these properties out: except().
Sourcepub fn additional(self, additional: impl Serialize) -> Self
pub fn additional(self, additional: impl Serialize) -> Self
Adds properties to the output: additional().
Sourcepub fn wrap(self, key: impl Into<String>) -> Self
pub fn wrap(self, key: impl Into<String>) -> Self
Wraps the response in a key, such as data: wrap().
Sourcepub fn without_wrapping(self) -> Self
pub fn without_wrapping(self) -> Self
Doesn’t wrap the response: withoutWrapping().
Sourcepub fn to_response_value(&self) -> Value
pub fn to_response_value(&self) -> Value
The value a response sends: the transformed value, wrapped in the data’s or the configured key.
Trait Implementations§
Source§impl<T: Clone> Clone for Transformation<T>
impl<T: Clone> Clone for Transformation<T>
Source§impl<T: Debug> Debug for Transformation<T>
impl<T: Debug> Debug for Transformation<T>
Source§impl<T: Serialize> IntoResponse for Transformation<T>
impl<T: Serialize> IntoResponse for Transformation<T>
Source§fn with_status(self, status: impl IntoStatusCode) -> Response
fn with_status(self, status: impl IntoStatusCode) -> Response
Send a cookie with this response, replacing any cookie the response already sends with the
same name, path, and domain. Read more
Source§fn with_header<K, V>(self, name: K, value: V) -> Response
fn with_header<K, V>(self, name: K, value: V) -> Response
Send a header with the response, replacing any header with the same name. A name or value
that isn’t a valid header makes the response a
500 error.Source§fn with_headers<K, V>(
self,
headers: impl IntoIterator<Item = (K, V)>,
) -> Response
fn with_headers<K, V>( self, headers: impl IntoIterator<Item = (K, V)>, ) -> Response
Send several headers with the response, each replacing any header with the same name. A
name or value that isn’t a valid header makes the response a
500 error.Auto Trait Implementations§
impl<T> Forget for Transformation<T>
impl<T> Freeze for Transformation<T>where
T: Freeze,
*const LeafNode<String, Partials> is !null: Freeze,
PhantomData<(Owned, LeafOrInternal)>: Freeze,
PhantomData<Box<(String, Partials)>>: Freeze,
*const u8 is !null: Freeze,
PhantomData<usize>: Freeze,
PhantomData<Bucket<String, Value>>: Freeze,
PhantomData<u8>: Freeze,
impl<T> Move for Transformation<T>
impl<T> RefUnwindSafe for Transformation<T>where
T: RefUnwindSafe,
impl<T> Send for Transformation<T>
impl<T> Sync for Transformation<T>
impl<T> Unpin for Transformation<T>
impl<T> UnsafeUnpin for Transformation<T>where
T: UnsafeUnpin,
*const LeafNode<String, Partials> is !null: UnsafeUnpin,
PhantomData<(Owned, LeafOrInternal)>: UnsafeUnpin,
PhantomData<Box<(String, Partials)>>: UnsafeUnpin,
*const u8 is !null: UnsafeUnpin,
PhantomData<usize>: UnsafeUnpin,
PhantomData<Bucket<String, Value>>: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
impl<T> UnwindSafe for Transformation<T>where
T: UnwindSafe,
BTreeMap<String, Partials>: UnwindSafe,
NonNull<u8>: UnwindSafe,
RawVecInner: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more