Skip to main content

Contract

Struct Contract 

Source
pub struct Contract(/* private fields */);
Expand description

Validated, versioned requirements for one device, server and principal.

Implementations§

Source§

impl Contract

Source

pub fn validate_capture_nodes(&self) -> Result<(), SnapshotReadError>

Check that live acquisition will not read application evidence from reserved session bootstrap nodes. This can be used before connecting or as part of offline preparation.

Source§

impl Contract

Source

pub fn validate_capture(&self, snapshot: &Snapshot) -> Result<(), Error>

Check that the collector accounted for every signal under the requested identities. A row without evidence records an unresolved namespace. When a node resolves, each requested attribute needs a result, including non-Good statuses.

Use this before publishing a new capture. Offline compare also accepts partial snapshots so previously collected evidence can still be assessed.

Source§

impl Contract

Source

pub fn new( device: impl Into<String>, application_uri: impl Into<String>, principal: impl Into<String>, signals: Vec<SignalRequirement>, ) -> Result<Self, Error>

Build a version 1 contract in memory using the same rules as parse_contract.

use opcua_kit::commissioning::{Contract, NodeId, SignalRequirement};
let node = NodeId::new("urn:plant:line-1", "s=PartsProduced")?;
let uint64 = NodeId::new("http://opcfoundation.org/UA/", "i=9")?;
let mut counter = SignalRequirement::new("PartsProduced", node, uint64);
counter.value_rank = Some(-1);
let contract = Contract::new("line-1", "urn:plant:server", "anonymous", vec![counter])?;
assert_eq!(contract.signals()[0].node.identifier(), "s=PartsProduced");
Source

pub fn device(&self) -> &str

Device identifier chosen by the application.

Source

pub fn application_uri(&self) -> &str

Expected server ApplicationUri.

Source

pub fn principal(&self) -> &str

Principal under which the attributes are to be read.

Source

pub fn signals(&self) -> &[SignalRequirement]

Validated signal requirements in declaration order, with canonical node identifiers.

Source

pub fn signal_count(&self) -> usize

Number of distinct signals required by this contract.

Trait Implementations§

Source§

impl Debug for Contract

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Serialize for Contract

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. 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<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

Source§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

Source§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

Source§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

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.