pub struct Header {
pub table_id: TableId,
pub table_name: Box<str>,
pub fields: Vec<Column>,
pub constraints: BTreeMap<ColList, Constraints>,
}Fields§
§table_id: TableId§table_name: Box<str>§fields: Vec<Column>§constraints: BTreeMap<ColList, Constraints>Implementations§
Source§impl Header
impl Header
Sourcepub fn new(
table_id: TableId,
table_name: Box<str>,
fields: Vec<Column>,
uncombined_constraints: impl IntoIterator<Item = (ColList, Constraints)>,
) -> Self
pub fn new( table_id: TableId, table_name: Box<str>, fields: Vec<Column>, uncombined_constraints: impl IntoIterator<Item = (ColList, Constraints)>, ) -> Self
Create a new header.
uncombined_constraints will be normalized using combine_constraints.
Sourcepub fn clone_for_error(&self) -> Self
pub fn clone_for_error(&self) -> Self
Equivalent to what Clone::clone would do.
Header intentionally does not implement Clone,
as we can’t afford to clone it in normal execution paths.
However, we don’t care about performance in error paths,
and we need to embed owned Headers in error objects to report useful messages.
Sourcepub fn column_pos(&self, col: FieldName) -> Option<ColId>
pub fn column_pos(&self, col: FieldName) -> Option<ColId>
Finds the index of the column with a matching FieldName.
pub fn column_pos_or_err(&self, col: FieldName) -> Result<ColId, RelationError>
pub fn field_name(&self, col: FieldName) -> Option<(ColId, FieldName)>
pub fn has_constraint(&self, field: ColId, constraint: Constraints) -> bool
Sourcepub fn project(&self, cols: &[ColExpr]) -> Result<Self, RelationError>
pub fn project(&self, cols: &[ColExpr]) -> Result<Self, RelationError>
Project the ColExprs & the Constraints that referenced them
Sourcepub fn project_col_list(&self, cols: &ColList) -> Self
pub fn project_col_list(&self, cols: &ColList) -> Self
Project the ourself onto the ColList, keeping constraints that reference the columns in the ColList.
Does not change ColIDs.
Sourcepub fn extend(&self, right: &Self) -> Self
pub fn extend(&self, right: &Self) -> Self
Adds the fields & Constraints from right to this Header,
renaming duplicated fields with a counter like a, a => a, a0.
Trait Implementations§
impl Eq for Header
impl StructuralPartialEq for Header
Auto Trait Implementations§
impl Freeze for Header
impl RefUnwindSafe for Header
impl Send for Header
impl Sync for Header
impl Unpin for Header
impl UnwindSafe for Header
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,
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
Compare self to
key and return true if they are equal.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