pub struct SchemaRegistry { /* private fields */ }Expand description
Schema registry for #/components/schemas.
This owns a schema map and provides register() helpers that return $refs.
Implementations§
Source§impl SchemaRegistry
impl SchemaRegistry
Sourcepub fn new() -> SchemaRegistry
pub fn new() -> SchemaRegistry
Create an empty registry.
Sourcepub fn register(&mut self, name: impl Into<String>, schema: Schema) -> Schema
pub fn register(&mut self, name: impl Into<String>, schema: Schema) -> Schema
Register schema under name if it doesn’t already exist, and return a $ref.
This does not overwrite an existing entry, which enables stable deduplication.
Sourcepub fn into_schemas(self) -> HashMap<String, Schema>
pub fn into_schemas(self) -> HashMap<String, Schema>
Consume the registry and return the underlying schema map.
Trait Implementations§
Source§impl Debug for SchemaRegistry
impl Debug for SchemaRegistry
Source§impl Default for SchemaRegistry
impl Default for SchemaRegistry
Source§fn default() -> SchemaRegistry
fn default() -> SchemaRegistry
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for SchemaRegistry
impl RefUnwindSafe for SchemaRegistry
impl Send for SchemaRegistry
impl Sync for SchemaRegistry
impl Unpin for SchemaRegistry
impl UnsafeUnpin for SchemaRegistry
impl UnwindSafe for SchemaRegistry
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, _span: NoopSpan) -> Self
fn instrument(self, _span: NoopSpan) -> Self
Instruments this future with a span (no-op when disabled).
Source§fn in_current_span(self) -> Self
fn in_current_span(self) -> Self
Instruments this future with the current span (no-op when disabled).