pub struct RelationHeader { /* private fields */ }Expand description
Metadata for a relation: its name, attribute names, and arity.
A header is named when attrs is non-empty (then arity == attrs.len()) and positional when attrs is empty (then arity is
the only authoritative column count). Orthogonally, a header is
nameless when its name is empty — used for intermediate or
projected relations whose origin no longer matters.
Implementations§
Source§impl RelationHeader
impl RelationHeader
Sourcepub fn new(name: impl Into<String>, attrs: Vec<String>) -> Self
pub fn new(name: impl Into<String>, attrs: Vec<String>) -> Self
Creates a named header with the given attribute names. Arity is
derived from attrs.len().
Sourcepub fn new_nameless(attrs: Vec<String>) -> Self
pub fn new_nameless(attrs: Vec<String>) -> Self
Creates a nameless header with the given attribute names. Arity is
inferred from the length of attrs.
Sourcepub fn new_positional(name: impl Into<String>, arity: usize) -> Self
pub fn new_positional(name: impl Into<String>, arity: usize) -> Self
Creates a named header with positional (unnamed) attributes.
Sourcepub fn new_nameless_positional(arity: usize) -> Self
pub fn new_nameless_positional(arity: usize) -> Self
Creates a nameless header with positional attributes of the given arity.
Sourcepub fn is_nameless(&self) -> bool
pub fn is_nameless(&self) -> bool
Returns true if this header has an empty name (i.e. was created via
one of the new_nameless* constructors).
Sourcepub fn model_type(&self) -> ModelType
pub fn model_type(&self) -> ModelType
Returns ModelType::Named when attribute names are set, otherwise
ModelType::Positional.
Trait Implementations§
Source§impl Clone for RelationHeader
impl Clone for RelationHeader
Source§fn clone(&self) -> RelationHeader
fn clone(&self) -> RelationHeader
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more