Skip to main content

Object

Struct Object 

Source
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

Source

pub fn new(class: ClassId, mrid: Mrid) -> Object

Source

pub fn class(&self) -> ClassId

Source

pub fn mrid(&self) -> &Mrid

Source

pub fn profiles(&self) -> ProfileMask

Profiles that contributed data to this object.

Source

pub fn from_file(&self) -> bool

Whether this object was read from a file rather than built programmatically.

Source

pub fn slots(&self) -> &[Slot]

All stored slots, in attribute order.

Source

pub fn values(&self) -> impl Iterator<Item = (AttrId, &Value)> + '_

All stored (attribute, value) pairs, in attribute order.

Source

pub fn len(&self) -> usize

Number of stored attribute occurrences.

Source

pub fn is_empty(&self) -> bool

Source

pub fn get(&self, attr: AttrId) -> Option<&Value>

First value of attr, if present.

Source

pub fn get_slot(&self, attr: AttrId) -> Option<&Slot>

First slot of attr, including its provenance.

Source

pub fn get_all(&self, attr: AttrId) -> &[Slot]

All slots of attr, for many-valued attributes.

Source

pub fn all(&self, attr: AttrId) -> impl Iterator<Item = &Value>

Every value of attr — the uniform accessor generated views use.

Source

pub fn count(&self, attr: AttrId) -> usize

Number of stored occurrences of attr.

Source

pub fn has(&self, attr: AttrId) -> bool

Source

pub fn set(&mut self, attr: AttrId, value: Value)

Replace every occurrence of attr with a single value of unknown provenance.

Source

pub fn set_in(&mut self, profiles: ProfileMask, attr: AttrId, value: Value)

Replace every occurrence of attr, recording which profile the value belongs to.

Source

pub fn set_slot(&mut self, slot: Slot)

Source

pub fn push(&mut self, attr: AttrId, value: Value)

Append another occurrence of attr, keeping storage sorted.

Source

pub fn push_in(&mut self, profiles: ProfileMask, attr: AttrId, value: Value)

Append another occurrence, recording which profile the value belongs to.

Source

pub fn push_slot(&mut self, slot: Slot)

Source

pub fn remove(&mut self, attr: AttrId) -> usize

Remove every occurrence of attr, returning how many were removed.

Source

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.

Trait Implementations§

Source§

impl Clone for Object

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Object

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Forget for Object

§

impl Freeze for Object

§

impl Move for Object

§

impl RefUnwindSafe for Object

§

impl Send for Object
where BoxRaw<str>: Send, RawVecInner: Send, BoxRaw<(f64, Box<str>)>: Send, BoxRaw<Compound>: Send,

§

impl Sync for Object
where BoxRaw<str>: Sync, RawVecInner: Sync, BoxRaw<(f64, Box<str>)>: Sync, BoxRaw<Compound>: Sync,

§

impl Unpin for Object
where Box<str>: Unpin, *const u8 is !null: Unpin, Box<(f64, Box<str>)>: Unpin, Box<Compound>: Unpin,

§

impl UnsafeUnpin for Object

§

impl UnwindSafe for Object
where BoxRaw<str>: UnwindSafe, RawVecInner: UnwindSafe, BoxRaw<(f64, Box<str>)>: UnwindSafe, BoxRaw<Compound>: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.