Struct minijinja::value::ViaDeserialize
source · pub struct ViaDeserialize<T>(pub T);
Expand description
Utility type to deserialize an argument.
This allows you to directly accept a type that implements Deserialize
as an
argument to a filter or test. The type dereferences into the inner type and
it also lets you move out the inner type.
use std::path::PathBuf;
use minijinja::value::ViaDeserialize;
fn dirname(path: ViaDeserialize<PathBuf>) -> String {
match path.parent() {
Some(parent) => parent.display().to_string(),
None => "".to_string()
}
}
env.add_filter("dirname", dirname);
Tuple Fields§
§0: T
Trait Implementations§
source§impl<'a, T: Deserialize<'a>> ArgType<'a> for ViaDeserialize<T>
impl<'a, T: Deserialize<'a>> ArgType<'a> for ViaDeserialize<T>
§type Output = ViaDeserialize<T>
type Output = ViaDeserialize<T>
The output type of this argument.
source§impl<T> Deref for ViaDeserialize<T>
impl<T> Deref for ViaDeserialize<T>
Auto Trait Implementations§
impl<T> Freeze for ViaDeserialize<T>where
T: Freeze,
impl<T> RefUnwindSafe for ViaDeserialize<T>where
T: RefUnwindSafe,
impl<T> Send for ViaDeserialize<T>where
T: Send,
impl<T> Sync for ViaDeserialize<T>where
T: Sync,
impl<T> Unpin for ViaDeserialize<T>where
T: Unpin,
impl<T> UnwindSafe for ViaDeserialize<T>where
T: 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