pub struct SchemaDescriptor { /* private fields */ }Expand description
A validated, versioned collection schema.
Implementations§
Source§impl SchemaDescriptor
impl SchemaDescriptor
Sourcepub fn new(
collection_name: impl Into<String>,
version: u32,
fields: Vec<FieldDescriptor>,
) -> Result<Self, SchemaError>
pub fn new( collection_name: impl Into<String>, version: u32, fields: Vec<FieldDescriptor>, ) -> Result<Self, SchemaError>
Validates and constructs a collection schema.
Sourcepub fn collection_name(&self) -> &str
pub fn collection_name(&self) -> &str
Returns the human-readable declared collection name.
Sourcepub const fn collection_id(&self) -> CollectionId
pub const fn collection_id(&self) -> CollectionId
Returns the stable collection identifier.
Sourcepub fn fields(&self) -> &[FieldDescriptor]
pub fn fields(&self) -> &[FieldDescriptor]
Returns fields in canonical numeric-ID order.
Sourcepub fn schema_id(&self) -> SchemaId
pub fn schema_id(&self) -> SchemaId
Returns the domain-separated hash of the canonical descriptor.
Sourcepub fn encode_canonical(&self) -> Vec<u8> ⓘ
pub fn encode_canonical(&self) -> Vec<u8> ⓘ
Encodes the descriptor into its durable canonical representation.
Sourcepub fn decode_canonical(bytes: &[u8]) -> Result<Self, SchemaError>
pub fn decode_canonical(bytes: &[u8]) -> Result<Self, SchemaError>
Decodes and validates an exact canonical descriptor.
Trait Implementations§
Source§impl Clone for SchemaDescriptor
impl Clone for SchemaDescriptor
Source§fn clone(&self) -> SchemaDescriptor
fn clone(&self) -> SchemaDescriptor
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 SchemaDescriptor
impl Debug for SchemaDescriptor
Source§impl PartialEq for SchemaDescriptor
impl PartialEq for SchemaDescriptor
impl Eq for SchemaDescriptor
impl StructuralPartialEq for SchemaDescriptor
Auto Trait Implementations§
impl Freeze for SchemaDescriptor
impl RefUnwindSafe for SchemaDescriptor
impl Send for SchemaDescriptor
impl Sync for SchemaDescriptor
impl Unpin for SchemaDescriptor
impl UnwindSafe for SchemaDescriptor
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