Skip to main content

Schema

Struct Schema 

Source
pub struct Schema(/* private fields */);
Expand description

A schema describing the structure of encoded row data.

Implementations§

Source§

impl Schema

Source

pub fn set_any(&self, row: &mut EncodedValues, index: usize, value: &Value)

Source

pub fn get_any(&self, row: &EncodedValues, index: usize) -> Value

Source§

impl Schema

Source

pub fn set_blob(&self, row: &mut EncodedValues, index: usize, value: &Blob)

Source

pub fn get_blob(&self, row: &EncodedValues, index: usize) -> Blob

Source

pub fn try_get_blob(&self, row: &EncodedValues, index: usize) -> Option<Blob>

Source§

impl Schema

Source

pub fn set_bool( &self, row: &mut EncodedValues, index: usize, value: impl Into<bool>, )

Source

pub fn get_bool(&self, row: &EncodedValues, index: usize) -> bool

Source

pub fn try_get_bool(&self, row: &EncodedValues, index: usize) -> Option<bool>

Source§

impl Schema

Source

pub fn set_date(&self, row: &mut EncodedValues, index: usize, value: Date)

Source

pub fn get_date(&self, row: &EncodedValues, index: usize) -> Date

Source

pub fn try_get_date(&self, row: &EncodedValues, index: usize) -> Option<Date>

Source§

impl Schema

Source

pub fn set_datetime( &self, row: &mut EncodedValues, index: usize, value: DateTime, )

Source

pub fn get_datetime(&self, row: &EncodedValues, index: usize) -> DateTime

Source

pub fn try_get_datetime( &self, row: &EncodedValues, index: usize, ) -> Option<DateTime>

Source§

impl Schema

Source

pub fn set_decimal( &self, row: &mut EncodedValues, index: usize, value: &Decimal, )

Set a Decimal value with 2-tier storage optimization

  • Values that fit in i128: stored inline with MSB=0
  • Large values: stored in dynamic section with MSB=1
Source

pub fn get_decimal(&self, row: &EncodedValues, index: usize) -> Decimal

Get a Decimal value, detecting storage mode from MSB

Source

pub fn try_get_decimal( &self, row: &EncodedValues, index: usize, ) -> Option<Decimal>

Try to get a Decimal value, returning None if undefined

Source§

impl Schema

Source

pub fn set_dictionary_id( &self, row: &mut EncodedValues, index: usize, entry: &DictionaryEntryId, )

Source

pub fn get_dictionary_id( &self, row: &EncodedValues, index: usize, ) -> DictionaryEntryId

Source

pub fn try_get_dictionary_id( &self, row: &EncodedValues, index: usize, ) -> Option<DictionaryEntryId>

Source§

impl Schema

Source

pub fn set_duration( &self, row: &mut EncodedValues, index: usize, value: Duration, )

Source

pub fn get_duration(&self, row: &EncodedValues, index: usize) -> Duration

Source

pub fn try_get_duration( &self, row: &EncodedValues, index: usize, ) -> Option<Duration>

Source§

impl Schema

Source

pub fn set_f32( &self, row: &mut EncodedValues, index: usize, value: impl Into<f32>, )

Source

pub fn get_f32(&self, row: &EncodedValues, index: usize) -> f32

Source

pub fn try_get_f32(&self, row: &EncodedValues, index: usize) -> Option<f32>

Source§

impl Schema

Source

pub fn set_f64( &self, row: &mut EncodedValues, index: usize, value: impl Into<f64>, )

Source

pub fn get_f64(&self, row: &EncodedValues, index: usize) -> f64

Source

pub fn try_get_f64(&self, row: &EncodedValues, index: usize) -> Option<f64>

Source§

impl Schema

Source

pub fn set_i128( &self, row: &mut EncodedValues, index: usize, value: impl Into<i128>, )

Source

pub fn get_i128(&self, row: &EncodedValues, index: usize) -> i128

Source

pub fn try_get_i128(&self, row: &EncodedValues, index: usize) -> Option<i128>

Source§

impl Schema

Source

pub fn set_i16( &self, row: &mut EncodedValues, index: usize, value: impl Into<i16>, )

Source

pub fn get_i16(&self, row: &EncodedValues, index: usize) -> i16

Source

pub fn try_get_i16(&self, row: &EncodedValues, index: usize) -> Option<i16>

Source§

impl Schema

Source

pub fn set_i32( &self, row: &mut EncodedValues, index: usize, value: impl Into<i32>, )

Source

pub fn get_i32(&self, row: &EncodedValues, index: usize) -> i32

Source

pub fn try_get_i32(&self, row: &EncodedValues, index: usize) -> Option<i32>

Source§

impl Schema

Source

pub fn set_i64( &self, row: &mut EncodedValues, index: usize, value: impl Into<i64>, )

Source

pub fn get_i64(&self, row: &EncodedValues, index: usize) -> i64

Source

pub fn try_get_i64(&self, row: &EncodedValues, index: usize) -> Option<i64>

Source§

impl Schema

Source

pub fn set_i8( &self, row: &mut EncodedValues, index: usize, value: impl Into<i8>, )

Source

pub fn get_i8(&self, row: &EncodedValues, index: usize) -> i8

Source

pub fn try_get_i8(&self, row: &EncodedValues, index: usize) -> Option<i8>

Source§

impl Schema

Source

pub fn set_identity_id( &self, row: &mut EncodedValues, index: usize, value: IdentityId, )

Source

pub fn get_identity_id(&self, row: &EncodedValues, index: usize) -> IdentityId

Source

pub fn try_get_identity_id( &self, row: &EncodedValues, index: usize, ) -> Option<IdentityId>

Source§

impl Schema

Source

pub fn set_int(&self, row: &mut EncodedValues, index: usize, value: &Int)

Set a Int value with 2-tier storage optimization

  • Values fitting in 127 bits: stored inline with MSB=0
  • Large values: stored in dynamic section with MSB=1
Source

pub fn get_int(&self, row: &EncodedValues, index: usize) -> Int

Get a Int value, detecting storage mode from MSB

Source

pub fn try_get_int(&self, row: &EncodedValues, index: usize) -> Option<Int>

Try to get a Int value, returning None if undefined

Source§

impl Schema

Source

pub fn new(fields: Vec<SchemaField>) -> Self

Create a new schema from a list of fields.

This computes the memory layout (offsets, alignment) and fingerprint.

Source

pub fn from_parts( fingerprint: SchemaFingerprint, fields: Vec<SchemaField>, ) -> Self

Create a schema from pre-computed fields and fingerprint. Used when loading from storage.

Source

pub fn fingerprint(&self) -> SchemaFingerprint

Get the schema’s fingerprint

Source

pub fn fields(&self) -> &[SchemaField]

Get the fields in this schema

Source

pub fn field_count(&self) -> usize

Get the number of fields

Source

pub fn find_field(&self, name: &str) -> Option<&SchemaField>

Find a field by name

Source

pub fn find_field_index(&self, name: &str) -> Option<usize>

Find field index by name

Source

pub fn get_field(&self, index: usize) -> Option<&SchemaField>

Find a field by index

Source

pub fn get_field_name(&self, index: usize) -> Option<&str>

Get field name by index

Source

pub fn field_names(&self) -> impl Iterator<Item = &str>

Get all field names as an iterator

Source

pub fn bitvec_size(&self) -> usize

Size of the bitvec section in bytes

Source

pub fn data_offset(&self) -> usize

Offset where field data starts (after header and bitvec)

Source

pub fn total_static_size(&self) -> usize

Total size of the static section

Source

pub fn dynamic_section_start(&self) -> usize

Start of the dynamic section

Source

pub fn dynamic_section_size(&self, row: &EncodedValues) -> usize

Size of the dynamic section

Source

pub fn allocate(&self) -> EncodedValues

Allocate a new encoded row

Source

pub fn set_none(&self, row: &mut EncodedValues, index: usize)

Set a field as undefined (not set)

Source

pub fn testing(types: &[Type]) -> Self

Create a schema from a list of types. Fields are named f0, f1, f2, etc. and have unconstrained types. Useful for tests and simple state schemas.

Source§

impl Schema

Source

pub fn set_time(&self, row: &mut EncodedValues, index: usize, value: Time)

Source

pub fn get_time(&self, row: &EncodedValues, index: usize) -> Time

Source

pub fn try_get_time(&self, row: &EncodedValues, index: usize) -> Option<Time>

Source§

impl Schema

Source

pub fn set_u128( &self, row: &mut EncodedValues, index: usize, value: impl Into<u128>, )

Source

pub fn get_u128(&self, row: &EncodedValues, index: usize) -> u128

Source

pub fn try_get_u128(&self, row: &EncodedValues, index: usize) -> Option<u128>

Source§

impl Schema

Source

pub fn set_u16( &self, row: &mut EncodedValues, index: usize, value: impl Into<u16>, )

Source

pub fn get_u16(&self, row: &EncodedValues, index: usize) -> u16

Source

pub fn try_get_u16(&self, row: &EncodedValues, index: usize) -> Option<u16>

Source§

impl Schema

Source

pub fn set_u32( &self, row: &mut EncodedValues, index: usize, value: impl Into<u32>, )

Source

pub fn get_u32(&self, row: &EncodedValues, index: usize) -> u32

Source

pub fn try_get_u32(&self, row: &EncodedValues, index: usize) -> Option<u32>

Source§

impl Schema

Source

pub fn set_u64( &self, row: &mut EncodedValues, index: usize, value: impl Into<u64>, )

Source

pub fn get_u64(&self, row: &EncodedValues, index: usize) -> u64

Source

pub fn try_get_u64(&self, row: &EncodedValues, index: usize) -> Option<u64>

Source§

impl Schema

Source

pub fn set_u8( &self, row: &mut EncodedValues, index: usize, value: impl Into<u8>, )

Source

pub fn get_u8(&self, row: &EncodedValues, index: usize) -> u8

Source

pub fn try_get_u8(&self, row: &EncodedValues, index: usize) -> Option<u8>

Source§

impl Schema

Source

pub fn set_uint(&self, row: &mut EncodedValues, index: usize, value: &Uint)

Set a Uint value with 2-tier storage optimization

  • Values fitting in 127 bits: stored inline with MSB=0
  • Large values: stored in dynamic section with MSB=1
Source

pub fn get_uint(&self, row: &EncodedValues, index: usize) -> Uint

Get a Uint value, detecting storage mode from MSB

Source

pub fn try_get_uint(&self, row: &EncodedValues, index: usize) -> Option<Uint>

Try to get a Uint value, returning None if undefined

Source§

impl Schema

Source

pub fn set_utf8( &self, row: &mut EncodedValues, index: usize, value: impl AsRef<str>, )

Source

pub fn get_utf8<'a>(&'a self, row: &'a EncodedValues, index: usize) -> &'a str

Source

pub fn try_get_utf8<'a>( &'a self, row: &'a EncodedValues, index: usize, ) -> Option<&'a str>

Source§

impl Schema

Source

pub fn set_uuid4(&self, row: &mut EncodedValues, index: usize, value: Uuid4)

Source

pub fn get_uuid4(&self, row: &EncodedValues, index: usize) -> Uuid4

Source

pub fn try_get_uuid4(&self, row: &EncodedValues, index: usize) -> Option<Uuid4>

Source§

impl Schema

Source

pub fn set_uuid7(&self, row: &mut EncodedValues, index: usize, value: Uuid7)

Source

pub fn get_uuid7(&self, row: &EncodedValues, index: usize) -> Uuid7

Source

pub fn try_get_uuid7(&self, row: &EncodedValues, index: usize) -> Option<Uuid7>

Source§

impl Schema

Source

pub fn set_values(&self, row: &mut EncodedValues, values: &[Value])

Source

pub fn set_value(&self, row: &mut EncodedValues, index: usize, val: &Value)

Source

pub fn get_value(&self, row: &EncodedValues, index: usize) -> Value

Trait Implementations§

Source§

impl Clone for Schema

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Schema

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Deref for Schema

Source§

type Target = Inner

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl From<&[ColumnDef]> for Schema

Source§

fn from(value: &[ColumnDef]) -> Self

Converts to this type from the input type.
Source§

impl From<&[SubscriptionColumnDef]> for Schema

Source§

fn from(value: &[SubscriptionColumnDef]) -> Self

Converts to this type from the input type.
Source§

impl From<&SubscriptionDef> for Schema

Source§

fn from(value: &SubscriptionDef) -> Self

Converts to this type from the input type.
Source§

impl From<&Vec<ColumnDef>> for Schema

Source§

fn from(value: &Vec<ColumnDef>) -> Self

Converts to this type from the input type.
Source§

impl From<&Vec<SubscriptionColumnDef>> for Schema

Source§

fn from(value: &Vec<SubscriptionColumnDef>) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for Schema

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for Schema

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more