pub struct Schema { /* private fields */ }Expand description
An ordered list of top-level fields, optionally named (a table, a
record type, a document), and the further tables a schema of several
holds (SQL DDL’s CREATE TABLEs).
Keys that span columns (a composite primary key, UNIQUE (a, b), a
FOREIGN KEY) are the schema’s own constraints;
a key on one column is that field’s.
Implementations§
Source§impl Schema
impl Schema
Sourcepub fn new(fields: impl IntoIterator<Item = Field>) -> Schema
pub fn new(fields: impl IntoIterator<Item = Field>) -> Schema
A schema of fields, in order.
Sourcepub fn of_tables(tables: impl IntoIterator<Item = Schema>) -> Schema
pub fn of_tables(tables: impl IntoIterator<Item = Schema>) -> Schema
A schema of tables, with no fields of its own.
Sourcepub fn with_description(self, description: impl Into<String>) -> Schema
pub fn with_description(self, description: impl Into<String>) -> Schema
Describe the schema.
Sourcepub fn with_constraint(self, constraint: Constraint) -> Schema
pub fn with_constraint(self, constraint: Constraint) -> Schema
Add a table-level constraint.
Sourcepub fn with_metadata(
self,
key: impl Into<String>,
value: impl Into<String>,
) -> Schema
pub fn with_metadata( self, key: impl Into<String>, value: impl Into<String>, ) -> Schema
Add a metadata entry (Arrow’s schema metadata).
Sourcepub fn truncated(self, truncated: bool) -> Schema
pub fn truncated(self, truncated: bool) -> Schema
Mark the schema as cut short by a reader’s limit.
Sourcepub fn description(&self) -> Option<&str>
pub fn description(&self) -> Option<&str>
The description, if any.
Sourcepub fn fields_mut(&mut self) -> &mut Vec<Field>
pub fn fields_mut(&mut self) -> &mut Vec<Field>
The top-level fields, to change in place.
Sourcepub fn index_of(&self, name: &str) -> Option<usize>
pub fn index_of(&self, name: &str) -> Option<usize>
The position of the first top-level field called name.
Sourcepub fn constraints(&self) -> &[Constraint]
pub fn constraints(&self) -> &[Constraint]
The table-level constraints.
Sourcepub fn constraints_mut(&mut self) -> &mut Vec<Constraint>
pub fn constraints_mut(&mut self) -> &mut Vec<Constraint>
The table-level constraints, to change in place.
Sourcepub fn primary_key(&self) -> Vec<&str>
pub fn primary_key(&self) -> Vec<&str>
The primary key’s columns: the table’s key when it spans columns, else every field marked as one.
Sourcepub fn foreign_keys(&self) -> Vec<ForeignKey>
pub fn foreign_keys(&self) -> Vec<ForeignKey>
Every foreign key: the table’s, then each column’s (with the column filled in).
Sourcepub fn tables_mut(&mut self) -> &mut Vec<Schema>
pub fn tables_mut(&mut self) -> &mut Vec<Schema>
The further tables, to change in place.
Sourcepub fn push_table(&mut self, table: Schema) -> &mut Schema
pub fn push_table(&mut self, table: Schema) -> &mut Schema
Add a table.
Sourcepub fn is_truncated(&self) -> bool
pub fn is_truncated(&self) -> bool
Whether a reader’s limit cut the schema short.
Trait Implementations§
impl Eq for Schema
Source§impl FromIterator<Field> for Schema
impl FromIterator<Field> for Schema
impl StructuralPartialEq for Schema
Auto Trait Implementations§
impl Freeze for Schema
impl RefUnwindSafe for Schema
impl Send for Schema
impl Sync for Schema
impl Unpin for Schema
impl UnsafeUnpin for Schema
impl UnwindSafe for Schema
Blanket Implementations§
impl<T> Allocation for T
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.