pub struct SchemaCache { /* private fields */ }Expand description
Cache for generated schemas.
Implementations§
Source§impl SchemaCache
impl SchemaCache
Sourcepub fn new() -> SchemaCache
pub fn new() -> SchemaCache
Create a new empty cache.
Sourcepub fn get(&self, name: &str) -> Option<&GeneratedSchema>
pub fn get(&self, name: &str) -> Option<&GeneratedSchema>
Get a cached schema by name.
Sourcepub fn store(&mut self, schema: GeneratedSchema)
pub fn store(&mut self, schema: GeneratedSchema)
Store a schema.
Sourcepub fn record_usage(&mut self, name: &str)
pub fn record_usage(&mut self, name: &str)
Record usage of a schema.
Sourcepub fn usage_count(&self, name: &str) -> usize
pub fn usage_count(&self, name: &str) -> usize
Get usage count for a schema.
Sourcepub fn schema_names(&self) -> Vec<&str>
pub fn schema_names(&self) -> Vec<&str>
Get all schema names.
Sourcepub fn remove(&mut self, name: &str) -> Option<GeneratedSchema>
pub fn remove(&mut self, name: &str) -> Option<GeneratedSchema>
Remove a schema.
Trait Implementations§
Source§impl Clone for SchemaCache
impl Clone for SchemaCache
Source§fn clone(&self) -> SchemaCache
fn clone(&self) -> SchemaCache
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SchemaCache
impl Debug for SchemaCache
Source§impl Default for SchemaCache
impl Default for SchemaCache
Source§fn default() -> SchemaCache
fn default() -> SchemaCache
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Forget for SchemaCache
impl Freeze for SchemaCachewhere
*const u8 is !null: Freeze,
PhantomData<(String, GeneratedSchema)>: Freeze,
PhantomData<(String, usize)>: Freeze,
impl Move for SchemaCache
impl RefUnwindSafe for SchemaCache
impl Send for SchemaCache
impl Sync for SchemaCache
impl Unpin for SchemaCache
impl UnsafeUnpin for SchemaCachewhere
*const u8 is !null: UnsafeUnpin,
PhantomData<(String, GeneratedSchema)>: UnsafeUnpin,
PhantomData<(String, usize)>: UnsafeUnpin,
impl UnwindSafe for SchemaCache
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