pub struct TypeTable { /* private fields */ }Expand description
Built-in and user-supplied mappings from canonical type path to schema.
Implementations§
Source§impl TypeTable
impl TypeTable
Sourcepub fn builtin() -> Self
pub fn builtin() -> Self
The curated set: std types plus ecosystem types whose serde representation is stable and unambiguous.
Sourcepub fn insert(
&mut self,
path: impl Into<String>,
mapping: impl Into<TypeMapping>,
)
pub fn insert( &mut self, path: impl Into<String>, mapping: impl Into<TypeMapping>, )
Add or override a mapping. User entries win over built-ins, so a crate with a custom serializer for a std type can correct the default.
A bare Value is a literal schema, so existing callers keep working
unchanged; pass a TypeMapping for anything else.
Sourcepub fn lookup(&self, canonical: &str) -> Option<&TypeMapping>
pub fn lookup(&self, canonical: &str) -> Option<&TypeMapping>
Look a canonical path up, accepting the shorter forms users actually
write in config: uuid::Uuid for uuid::Uuid, and the bare type name
when a crate re-exports from a private module.
Trait Implementations§
Auto Trait Implementations§
impl Forget for TypeTable
impl Freeze for TypeTablewhere
*const LeafNode<String, TypeMapping> is !null: Freeze,
PhantomData<(Owned, LeafOrInternal)>: Freeze,
PhantomData<Box<(String, TypeMapping)>>: Freeze,
impl Move for TypeTable
impl RefUnwindSafe for TypeTable
impl Send for TypeTablewhere
NodeRef<Owned, String, TypeMapping, LeafOrInternal>: Send,
BoxRaw<(String, TypeMapping)>: Send,
impl Sync for TypeTablewhere
NodeRef<Owned, String, TypeMapping, LeafOrInternal>: Sync,
BoxRaw<(String, TypeMapping)>: Sync,
impl Unpin for TypeTable
impl UnsafeUnpin for TypeTablewhere
*const LeafNode<String, TypeMapping> is !null: UnsafeUnpin,
PhantomData<(Owned, LeafOrInternal)>: UnsafeUnpin,
PhantomData<Box<(String, TypeMapping)>>: UnsafeUnpin,
impl UnwindSafe for TypeTable
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