pub struct TypeRegistry { /* private fields */ }Expand description
Registry of type validators.
In production, this is populated by the #[wasm_validate] proc macro.
For now, users must manually register types.
Implementations§
Source§impl TypeRegistry
impl TypeRegistry
Sourcepub fn register<T>(&mut self, type_name: &'static str)where
T: Validate + DeserializeOwned + 'static,
pub fn register<T>(&mut self, type_name: &'static str)where
T: Validate + DeserializeOwned + 'static,
Register a type validator
Sourcepub fn validate(&self, type_name: &str, json: &str) -> Result<(), DispatchError>
pub fn validate(&self, type_name: &str, json: &str) -> Result<(), DispatchError>
Validate JSON against a registered type
Sourcepub fn type_names(&self) -> Vec<&'static str>
pub fn type_names(&self) -> Vec<&'static str>
List all registered type names
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TypeRegistry
impl RefUnwindSafe for TypeRegistry
impl Send for TypeRegistry
impl Sync for TypeRegistry
impl Unpin for TypeRegistry
impl UnwindSafe for TypeRegistry
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