pub struct Object { /* private fields */ }Expand description
A single CIM object.
Storage is sparse — only attributes actually present are stored — which matches how
CIM data behaves: a Terminal carries roughly thirty possible attributes but a
Steady State Hypothesis file sets exactly one of them. Slots are kept sorted by
AttrId, with repeats adjacent for many-valued attributes.
Implementations§
Source§impl Object
impl Object
pub fn new(class: ClassId, mrid: Mrid) -> Object
pub fn class(&self) -> ClassId
pub fn mrid(&self) -> &Mrid
Sourcepub fn profiles(&self) -> ProfileMask
pub fn profiles(&self) -> ProfileMask
Profiles that contributed data to this object.
Sourcepub fn from_file(&self) -> bool
pub fn from_file(&self) -> bool
Whether this object was read from a file rather than built programmatically.
Sourcepub fn values(&self) -> impl Iterator<Item = (AttrId, &Value)> + '_
pub fn values(&self) -> impl Iterator<Item = (AttrId, &Value)> + '_
All stored (attribute, value) pairs, in attribute order.
pub fn is_empty(&self) -> bool
Sourcepub fn get_slot(&self, attr: AttrId) -> Option<&Slot>
pub fn get_slot(&self, attr: AttrId) -> Option<&Slot>
First slot of attr, including its provenance.
Sourcepub fn all(&self, attr: AttrId) -> impl Iterator<Item = &Value>
pub fn all(&self, attr: AttrId) -> impl Iterator<Item = &Value>
Every value of attr — the uniform accessor generated views use.
pub fn has(&self, attr: AttrId) -> bool
Sourcepub fn set(&mut self, attr: AttrId, value: Value)
pub fn set(&mut self, attr: AttrId, value: Value)
Replace every occurrence of attr with a single value of unknown provenance.
Sourcepub fn set_in(&mut self, profiles: ProfileMask, attr: AttrId, value: Value)
pub fn set_in(&mut self, profiles: ProfileMask, attr: AttrId, value: Value)
Replace every occurrence of attr, recording which profile the value belongs to.
pub fn set_slot(&mut self, slot: Slot)
Sourcepub fn push(&mut self, attr: AttrId, value: Value)
pub fn push(&mut self, attr: AttrId, value: Value)
Append another occurrence of attr, keeping storage sorted.
Sourcepub fn push_in(&mut self, profiles: ProfileMask, attr: AttrId, value: Value)
pub fn push_in(&mut self, profiles: ProfileMask, attr: AttrId, value: Value)
Append another occurrence, recording which profile the value belongs to.
pub fn push_slot(&mut self, slot: Slot)
Sourcepub fn remove(&mut self, attr: AttrId) -> usize
pub fn remove(&mut self, attr: AttrId) -> usize
Remove every occurrence of attr, returning how many were removed.
Sourcepub fn remove_value(&mut self, attr: AttrId, value: &Value) -> bool
pub fn remove_value(&mut self, attr: AttrId, value: &Value) -> bool
Remove one specific (attr, value) occurrence, e.g. when applying a
difference model’s reverse statements. Returns whether one was removed.