pub struct SchemaReference {
pub name: Cow<'static, str>,
pub inline: bool,
pub references: Vec<Self>,
}Expand description
Tracks schema references for generic type resolution.
SchemaReference represents a schema and its generic parameter references,
enabling recursive schema composition for generic types.
Fields§
§name: Cow<'static, str>The schema name.
inline: boolWhether this schema should be inlined rather than referenced.
references: Vec<Self>Child references for generic type parameters.
Implementations§
Source§impl SchemaReference
impl SchemaReference
Sourcepub fn new(name: impl Into<Cow<'static, str>>) -> Self
pub fn new(name: impl Into<Cow<'static, str>>) -> Self
Create a new SchemaReference with the given name.
Sourcepub fn reference(self, reference: Self) -> Self
pub fn reference(self, reference: Self) -> Self
Add a child reference for a generic type parameter.
Sourcepub fn compose_name(&self) -> String
pub fn compose_name(&self) -> String
Get the composed name including generic parameters.
For example, Page with child User produces Page<User>.
Sourcepub fn compose_generics(&self) -> &[Self]
pub fn compose_generics(&self) -> &[Self]
Get the schemas for the direct generic type parameters.
Sourcepub fn compose_child_references(&self) -> Vec<&Self>
pub fn compose_child_references(&self) -> Vec<&Self>
Collect all child references recursively (depth-first).
Trait Implementations§
Source§impl Clone for SchemaReference
impl Clone for SchemaReference
Source§fn clone(&self) -> SchemaReference
fn clone(&self) -> SchemaReference
Returns a duplicate of the value. Read more
1.0.0 · 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 SchemaReference
impl Debug for SchemaReference
Source§impl Default for SchemaReference
impl Default for SchemaReference
Source§fn default() -> SchemaReference
fn default() -> SchemaReference
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for SchemaReference
impl RefUnwindSafe for SchemaReference
impl Send for SchemaReference
impl Sync for SchemaReference
impl Unpin for SchemaReference
impl UnsafeUnpin for SchemaReference
impl UnwindSafe for SchemaReference
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