pub struct Context<'a> { /* private fields */ }Expand description
Decoding/encoding context. Lifetime is typically tied to an instance of ContextOwned.
Implementations§
Source§impl<'a> Context<'a>
impl<'a> Context<'a>
Sourcepub fn new(
namespaces: &'a NamespaceMap,
loaders: &'a TypeLoaderCollection,
options: DecodingOptions,
) -> Self
pub fn new( namespaces: &'a NamespaceMap, loaders: &'a TypeLoaderCollection, options: DecodingOptions, ) -> Self
Constructor. Prefer to use ContextOwned to avoid having to juggle
NamespaceMap and TypeLoaderCollection yourself.
Sourcepub fn load_from_json(
&self,
node_id: &NodeId,
stream: &mut JsonStreamReader<&mut dyn Read>,
) -> EncodingResult<ExtensionObject>
pub fn load_from_json( &self, node_id: &NodeId, stream: &mut JsonStreamReader<&mut dyn Read>, ) -> EncodingResult<ExtensionObject>
Try to load a type dynamically from JSON, returning an error if no matching type loader was found.
Sourcepub fn load_from_binary(
&self,
node_id: &NodeId,
stream: &mut dyn Read,
length: Option<usize>,
) -> EncodingResult<ExtensionObject>
pub fn load_from_binary( &self, node_id: &NodeId, stream: &mut dyn Read, length: Option<usize>, ) -> EncodingResult<ExtensionObject>
Try to load a type dynamically from OPC-UA binary, returning an error if no matching type loader was found.
Sourcepub fn load_from_xml(
&self,
node_id: &NodeId,
stream: &mut XmlStreamReader<&mut dyn Read>,
name: &str,
) -> EncodingResult<ExtensionObject>
pub fn load_from_xml( &self, node_id: &NodeId, stream: &mut XmlStreamReader<&mut dyn Read>, name: &str, ) -> EncodingResult<ExtensionObject>
Try to load a type dynamically from XML, returning an error if no matching type loader was found.
Sourcepub fn options(&self) -> &DecodingOptions
pub fn options(&self) -> &DecodingOptions
Get the decoding options.
Sourcepub fn namespaces(&self) -> &'a NamespaceMap
pub fn namespaces(&self) -> &'a NamespaceMap
Get the namespace map.
Sourcepub fn set_index_map(&mut self, index_map: &'a HashMap<u16, u16>)
pub fn set_index_map(&mut self, index_map: &'a HashMap<u16, u16>)
Set the index map used for resolving namespace indices during XML decoding.
Sourcepub fn set_aliases(&mut self, aliases: &'a HashMap<String, String>)
pub fn set_aliases(&mut self, aliases: &'a HashMap<String, String>)
Set the alias table used for resolving node ID aliases during XML decoding.
Sourcepub fn resolve_namespace_index(
&self,
index_in_node_set: u16,
) -> Result<u16, UninitializedIndex>
pub fn resolve_namespace_index( &self, index_in_node_set: u16, ) -> Result<u16, UninitializedIndex>
Resolve the given namespace index to the real, server namespace index. Used when loading nodeset files.
Sourcepub fn resolve_namespace_index_inverse(
&self,
index_in_server: u16,
) -> Result<u16, UninitializedIndex>
pub fn resolve_namespace_index_inverse( &self, index_in_server: u16, ) -> Result<u16, UninitializedIndex>
Look up namespace index in reverse, finding the index in the node set given the index in the server.
Sourcepub fn resolve_alias<'b>(&self, node_id_str: &'b str) -> &'b strwhere
'a: 'b,
pub fn resolve_alias<'b>(&self, node_id_str: &'b str) -> &'b strwhere
'a: 'b,
Resolve a node ID alias, if the alias table is registered. Only used for XML decoding when loading nodeset files.
Sourcepub fn resolve_alias_inverse<'b>(&self, node_id_str: &'b str) -> &'b strwhere
'a: 'b,
pub fn resolve_alias_inverse<'b>(&self, node_id_str: &'b str) -> &'b strwhere
'a: 'b,
Resolve a node ID alias in inverse, getting the alias value given the node ID.
Sourcepub fn with_zero_offset(&self) -> Cow<'_, Self>
pub fn with_zero_offset(&self) -> Cow<'_, Self>
Produce a copy of self with zero client_offset, or a borrow if the offset is already zero.