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<SchemaDescriptor, SchemaError>
pub fn new( collection_name: impl Into<String>, version: u32, fields: Vec<FieldDescriptor>, ) -> Result<SchemaDescriptor, 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<SchemaDescriptor, SchemaError>
pub fn decode_canonical(bytes: &[u8]) -> Result<SchemaDescriptor, 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more