Struct tc_table::IndexSchema
source · pub struct IndexSchema { /* private fields */ }
Expand description
The schema of a Table
index
Implementations§
source§impl IndexSchema
impl IndexSchema
sourcepub fn column_names(&self) -> impl Iterator<Item = &Id>
pub fn column_names(&self) -> impl Iterator<Item = &Id>
Iterate over the names of the columns in this schema.
sourcepub fn key_values_from_row(
&self,
row: Row,
reject_extras: bool
) -> TCResult<(Key, Values)>
pub fn key_values_from_row(
&self,
row: Row,
reject_extras: bool
) -> TCResult<(Key, Values)>
Given a Row
, return a (key, values)
tuple.
sourcepub fn key_values_from_tuple(
&self,
tuple: Tuple<Value>
) -> TCResult<(Vec<Value>, Vec<Value>)>
pub fn key_values_from_tuple(
&self,
tuple: Tuple<Value>
) -> TCResult<(Vec<Value>, Vec<Value>)>
Given a Row
, return a (key, values)
tuple.
sourcepub fn row_from_key_values(&self, key: Key, values: Values) -> TCResult<Row>
pub fn row_from_key_values(&self, key: Key, values: Values) -> TCResult<Row>
Given a key
and values
, return a Row
.
sourcepub fn row_from_values(&self, values: Values) -> TCResult<Row>
pub fn row_from_values(&self, values: Values) -> TCResult<Row>
Given a list of Value
s, return a Row
.
sourcepub fn starts_with(&self, expected: &[Id]) -> bool
pub fn starts_with(&self, expected: &[Id]) -> bool
Return true
if this schema starts with the given slice of column names.
sourcepub fn auxiliary(&self, key: &[Id]) -> TCResult<IndexSchema>
pub fn auxiliary(&self, key: &[Id]) -> TCResult<IndexSchema>
Return the IndexSchema
needed to index the given columns.
sourcepub fn validate_columns(&self, columns: &[Id]) -> TCResult<()>
pub fn validate_columns(&self, columns: &[Id]) -> TCResult<()>
Return an error if this schema does not support ordering by the given columns.
sourcepub fn validate_key(&self, key: Key) -> TCResult<Key>
pub fn validate_key(&self, key: Key) -> TCResult<Key>
Return an error if the given key does not match this schema.
sourcepub fn validate_values(&self, values: Values) -> TCResult<Key>
pub fn validate_values(&self, values: Values) -> TCResult<Key>
Return an error if the given values do not match this schema.
sourcepub fn validate_row_partial(&self, row: Row) -> TCResult<Row>
pub fn validate_row_partial(&self, row: Row) -> TCResult<Row>
Return an error if the given Row
has any extra fields or incompatible values.
Trait Implementations§
source§impl CastFrom<IndexSchema> for Value
impl CastFrom<IndexSchema> for Value
source§fn cast_from(schema: IndexSchema) -> Self
fn cast_from(schema: IndexSchema) -> Self
Cast an instance of
T
into an instance of Self
.source§impl Clone for IndexSchema
impl Clone for IndexSchema
source§fn clone(&self) -> IndexSchema
fn clone(&self) -> IndexSchema
Returns a copy 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 Display for IndexSchema
impl Display for IndexSchema
source§impl From<IndexSchema> for RowSchema
impl From<IndexSchema> for RowSchema
source§fn from(schema: IndexSchema) -> RowSchema
fn from(schema: IndexSchema) -> RowSchema
Converts to this type from the input type.
source§impl From<IndexSchema> for TableSchema
impl From<IndexSchema> for TableSchema
source§fn from(schema: IndexSchema) -> TableSchema
fn from(schema: IndexSchema) -> TableSchema
Converts to this type from the input type.
source§impl FromStream for IndexSchema
impl FromStream for IndexSchema
source§impl<'en> IntoStream<'en> for IndexSchema
impl<'en> IntoStream<'en> for IndexSchema
source§impl PartialEq<IndexSchema> for IndexSchema
impl PartialEq<IndexSchema> for IndexSchema
source§fn eq(&self, other: &IndexSchema) -> bool
fn eq(&self, other: &IndexSchema) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl<'en> ToStream<'en> for IndexSchema
impl<'en> ToStream<'en> for IndexSchema
source§impl TryCastFrom<Value> for IndexSchema
impl TryCastFrom<Value> for IndexSchema
source§fn can_cast_from(value: &Value) -> bool
fn can_cast_from(value: &Value) -> bool
Test if
value
can be cast into Self
.source§fn opt_cast_from(value: Value) -> Option<IndexSchema>
fn opt_cast_from(value: Value) -> Option<IndexSchema>
Returns
Some(Self)
if the source value can be cast into Self
, otherwise None
.impl Eq for IndexSchema
impl StructuralEq for IndexSchema
impl StructuralPartialEq for IndexSchema
Auto Trait Implementations§
impl RefUnwindSafe for IndexSchema
impl Send for IndexSchema
impl Sync for IndexSchema
impl Unpin for IndexSchema
impl UnwindSafe for IndexSchema
Blanket Implementations§
source§impl<F> Match for F
impl<F> Match for F
source§fn matches<T>(&self) -> boolwhere
T: TryCastFrom<Self>,
fn matches<T>(&self) -> boolwhere
T: TryCastFrom<Self>,
Returns
true
if self
can be cast into the target type T
.source§impl<F, T> TryCastFrom<F> for Twhere
T: CastFrom<F>,
impl<F, T> TryCastFrom<F> for Twhere
T: CastFrom<F>,
source§fn can_cast_from(_: &F) -> bool
fn can_cast_from(_: &F) -> bool
Test if
value
can be cast into Self
.source§fn opt_cast_from(f: F) -> Option<T>
fn opt_cast_from(f: F) -> Option<T>
Returns
Some(Self)
if the source value can be cast into Self
, otherwise None
.source§impl<F, T> TryCastInto<T> for Fwhere
T: TryCastFrom<F>,
impl<F, T> TryCastInto<T> for Fwhere
T: TryCastFrom<F>,
source§fn can_cast_into(&self) -> bool
fn can_cast_into(&self) -> bool
Test if
self
can be cast into T
.source§fn opt_cast_into(self) -> Option<T>
fn opt_cast_into(self) -> Option<T>
Returns
Some(T)
if self
can be cast into T
, otherwise None
.