pub struct Schema { /* private fields */ }Expand description
The schema of one keychain.
Implementations§
Source§impl Schema
impl Schema
Sourcepub fn bootstrap() -> Self
pub fn bootstrap() -> Self
Built-in definitions for the four schema relations, enough to read the schema tables and learn everything else.
Sourcepub fn from_tables(tables: &[Table]) -> Result<Self>
pub fn from_tables(tables: &[Table]) -> Result<Self>
Read the schema out of a keychain’s own schema tables.
pub fn relation(&self, record_type: RecordType) -> Option<&Relation>
pub fn relations(&self) -> impl Iterator<Item = &Relation>
Sourcepub fn attribute_formats(&self, record_type: RecordType) -> Vec<AttributeFormat>
pub fn attribute_formats(&self, record_type: RecordType) -> Vec<AttributeFormat>
Attribute formats in record order. Empty when the relation is unknown, which makes such a record parse as having no attributes.
Sourcepub fn attribute<'r>(
&self,
record_type: RecordType,
record: &'r Record,
name: &str,
) -> Option<&'r Value>
pub fn attribute<'r>( &self, record_type: RecordType, record: &'r Record, name: &str, ) -> Option<&'r Value>
Look up a value on a record by attribute name.
Sourcepub fn named_attributes<'r>(
&self,
record_type: RecordType,
record: &'r Record,
) -> Vec<(&str, &'r Value)>
pub fn named_attributes<'r>( &self, record_type: RecordType, record: &'r Record, ) -> Vec<(&str, &'r Value)>
Every named attribute of a record that has a value.
Trait Implementations§
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§
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