pub struct Constraint {
pub entries: Vec<(String, Option<Value>)>,
}Expand description
Keys keep insertion order, like the JS object: a memory source builds its
index sort from it. A value is None where JS has undefined.
Fields§
§entries: Vec<(String, Option<Value>)>Implementations§
Source§impl Constraint
impl Constraint
pub fn new(entries: Vec<(String, Option<Value>)>) -> Self
pub fn keys(&self) -> Vec<&str>
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn has(&self, key: &str) -> bool
Sourcepub fn get(&self, key: &str) -> Option<&Value>
pub fn get(&self, key: &str) -> Option<&Value>
The value for key; None when absent or undefined.
pub fn set(&mut self, key: &str, value: Option<Value>)
Sourcepub fn merging(&self, other: &Constraint) -> Constraint
pub fn merging(&self, other: &Constraint) -> Constraint
{...self, ...other}.
Sourcepub fn is_compatible(&self, other: &Constraint) -> bool
pub fn is_compatible(&self, other: &Constraint) -> bool
constraintsAreCompatible: no shared key has different values.
Sourcepub fn matches_primary_key(&self, primary_key: &[String]) -> bool
pub fn matches_primary_key(&self, primary_key: &[String]) -> bool
constraintMatchesPrimaryKey.
Sourcepub fn from_row(row: &Row, keys: &[String]) -> Constraint
pub fn from_row(row: &Row, keys: &[String]) -> Constraint
{key: row[key]} for each of keys.
Trait Implementations§
Source§impl Clone for Constraint
impl Clone for Constraint
Source§impl Debug for Constraint
impl Debug for Constraint
Source§impl Default for Constraint
impl Default for Constraint
Source§impl PartialEq for Constraint
impl PartialEq for Constraint
impl StructuralPartialEq for Constraint
Auto Trait Implementations§
impl Forget for Constraint
impl Freeze for Constraint
impl Move for Constraint
impl RefUnwindSafe for Constraint
impl Send for Constraint
impl Sync for Constraint
impl Unpin for Constraint
impl UnsafeUnpin for Constraint
impl UnwindSafe for Constraint
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