Skip to main content

CimDataset

Struct CimDataset 

Source
pub struct CimDataset {
    pub entries: FastMap<String, Element>,
    pub by_type: FastMap<String, Vec<String>>,
}

Fields§

§entries: FastMap<String, Element>§by_type: FastMap<String, Vec<String>>

Maps type_name() → list of MRIDs of that type. Populated on insert, maintained on merge.

Implementations§

Source§

impl CimDataset

Source

pub fn new() -> Self

Source

pub fn decode_str(content: &str) -> Result<Self, Box<dyn Error>>

Decode an RDF/XML string into a CimDataset, using the provided type registry.

Source

pub fn decode_file(path: &Path) -> Result<Self, Box<dyn Error>>

Decode an RDF/XML file into a CimDataset, using the provided type registry.

Source

pub fn decode_files(paths: &[&Path]) -> Result<Self, Box<dyn Error>>

Decode multiple RDF/XML files into a single CimDataset, merging entries with the same MRID.

Source

pub fn decode_files_parallel_separate( paths: &[&Path], ) -> Result<Vec<Self>, Box<dyn Error>>

Decode files in parallel using one thread per file, without merging. Preserves input order. Falls back to sequential decoding for 0–1 paths to avoid thread-spawn overhead.

Source

pub fn decode_files_parallel(paths: &[&Path]) -> Result<Self, Box<dyn Error>>

Decode files in parallel using one thread per file, then merge sequentially.

Source

pub fn merge(&mut self, other: CimDataset)

Merge another dataset into self, combining objects with the same MRID: a later scalar wins, reference lists are joined. An object keeps the class it was first decoded as.

Where the files type an object differently — an SSH file writing cim:Equipment for what the EQ file wrote as cim:ACLineSegment — the object keeps every type, as the RDF union does (Element::types), and its class (and by_type bucket) is the most specific, whichever file came first. Of unrelated classes the first stays the class.

Source

pub fn set(&mut self, mrid: String, element: Element)

Insert or replace the element at mrid, keeping by_type consistent (including the case where mrid already exists under a different type).

Source

pub fn remove(&mut self, mrid: &str) -> Option<Element>

Remove the element at mrid, pruning it from by_type. Returns the removed element, or None if mrid was not present.

Trait Implementations§

Source§

impl Default for CimDataset

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

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> 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> Same for T

Source§

type Output = T

Should always be Self
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.