pub struct VldPayload<T>(pub T);Expand description
Auto-validating wrapper for Tauri command parameters.
Implements Deserialize — on deserialization the incoming JSON is
validated through T::vld_parse_value(). If validation fails,
deserialization returns a serde::de::Error with the full message.
Implements Deref to T so fields are accessible
directly.
§Example
ⓘ
#[tauri::command]
fn greet(payload: VldPayload<GreetArgs>) -> Result<String, VldTauriError> {
Ok(format!("Hello, {}!", payload.name))
}Tuple Fields§
§0: TTrait Implementations§
Source§impl<T: Clone> Clone for VldPayload<T>
impl<T: Clone> Clone for VldPayload<T>
Source§impl<T: Debug> Debug for VldPayload<T>
impl<T: Debug> Debug for VldPayload<T>
Source§impl<T> Deref for VldPayload<T>
impl<T> Deref for VldPayload<T>
Source§impl<T> DerefMut for VldPayload<T>
impl<T> DerefMut for VldPayload<T>
Source§impl<'de, T: VldParse> Deserialize<'de> for VldPayload<T>
impl<'de, T: VldParse> Deserialize<'de> for VldPayload<T>
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl<T> Freeze for VldPayload<T>where
T: Freeze,
impl<T> RefUnwindSafe for VldPayload<T>where
T: RefUnwindSafe,
impl<T> Send for VldPayload<T>where
T: Send,
impl<T> Sync for VldPayload<T>where
T: Sync,
impl<T> Unpin for VldPayload<T>where
T: Unpin,
impl<T> UnsafeUnpin for VldPayload<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for VldPayload<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