Skip to main content

NodeSet2Import

Struct NodeSet2Import 

Source
pub struct NodeSet2Import { /* private fields */ }
Expand description

NodeSetImport implementation for dynamically loading NodeSet2 files at runtime. Note that structures must be loaded with a type loader. By default the type loader for the base types is registered, but if your NodeSet2 file uses custom types you will have to add an TypeLoader using NodeSet2Import::add_type_loader.

Implementations§

Source§

impl NodeSet2Import

Source

pub fn new( preferred_locale: &str, path: impl AsRef<Path>, dependent_namespaces: Vec<String>, ) -> Result<Self, LoadXmlError>

Create a new NodeSet2 importer. The dependent_namespaces array contains namespaces that this nodeset requires, in order, but that are not included in the nodeset file itself. It does not need to include the base namespace, but it may.

§Example
NodeSet2Import::new(
    "en",
    "My.ISA95.Extension.NodeSet2.xml",
    // Since we depend on ISA95, we need to include the ISA95 namespace.
    // Typically, the NodeSet will reference ns=1 as ISA95, and ns=2 as its own
    // namespace, this will allow us to interpret ns=1 correctly. Without this,
    // we would panic when failing to look up ns=2.
    vec!["http://www.OPCFoundation.org/UA/2013/01/ISA95"]
)
Source

pub fn new_str( preferred_locale: &str, nodeset: &str, dependent_namespaces: Vec<String>, ) -> Result<Self, LoadXmlError>

Create a new NodeSet2 importer from an already loaded NodeSet2.xml file.

See documentation of NodeSet2Import::new.

Source

pub fn new_nodeset( preferred_locale: &str, nodeset: UANodeSet, dependent_namespaces: Vec<String>, ) -> Self

Create a new importer with a pre-loaded nodeset. The dependent_namespaces array contains namespaces that this nodeset requires, in order, but that are not included in the nodeset file itself. It does not need to include the base namespace, but it may.

Source

pub fn add_type_loader(&mut self, loader: Arc<dyn TypeLoader>)

Add a type loader for importing types from XML.

Any custom variable Value must be supported by one of the added type loaders in order for the node set import to work.

Trait Implementations§

Source§

impl NodeSetImport for NodeSet2Import

Source§

fn register_namespaces(&self, namespaces: &mut NodeSetNamespaceMapper<'_>)

Register all namespaces used by this importer in a node set map.
Source§

fn get_own_namespaces(&self) -> Vec<String>

Get a list of namespaces that this import owns. This must be a subset of the namespaces it uses, registered in register_namespaces
Source§

fn load<'a>( &'a self, namespaces: &'a NodeSetNamespaceMapper<'_>, ) -> Box<dyn Iterator<Item = ImportedItem> + 'a>

Create an iterator over items imported from the nodeset. This will usually be lazy.

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

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more