Struct open62541::AsyncClient

source ·
pub struct AsyncClient { /* private fields */ }
Expand description

Connected OPC UA client (with asynchronous API).

Implementations§

source§

impl AsyncClient

source

pub fn new(endpoint_url: &str, cycle_time: Duration) -> Result<Self, Error>

Creates client connected to endpoint.

If you need more control over the initialization, use ClientBuilder instead, and turn it into Client by calling connect(), followed by into_async() to get the asynchronous API.

§Errors

See ClientBuilder::connect() and Client::into_async().

§Panics

See ClientBuilder::connect().

source

pub fn state(&self) -> Result<ClientState, Error>

Gets current channel and session state, and connect status.

§Errors

This only fails when the client has an internal error.

source

pub async fn read_value(&self, node_id: &NodeId) -> Result<DataValue, Error>

Reads value from server.

§Errors

This fails when the node does not exist or its value attribute cannot be read.

source

pub async fn write_value( &self, node_id: &NodeId, value: &DataValue ) -> Result<(), Error>

Writes value from server.

§Errors

This fails when the node does not exist or its value attribute cannot be written.

source

pub async fn call_method( &self, object_id: &NodeId, method_id: &NodeId, input_arguments: &[Variant] ) -> Result<Option<Vec<Variant>>, Error>

Calls specific method node at object node.

§Errors

This fails when the object or method node does not exist, the method cannot be called, or the input arguments are unexpected.

source

pub async fn browse( &self, node_id: &NodeId ) -> Result<Vec<ReferenceDescription>, Error>

Browses specific node.

§Errors

This fails when the node does not exist or it cannot be browsed.

source

pub async fn browse_many( &self, node_ids: &[impl Borrow<NodeId>] ) -> Result<Vec<Option<Vec<ReferenceDescription>>>, Error>

Browses several nodes at once.

This issues only a single request to the OPC UA server (and should be preferred over several individual requests with browse() when browsing multiple nodes).

The size and order of the result list matches the size and order of the given node ID list.

§Errors

This fails when any of the given nodes does not exist or cannot be browsed.

source

pub async fn create_subscription(&self) -> Result<AsyncSubscription, Error>

Creates new subscription.

§Errors

This fails when the client is not connected.

Trait Implementations§

source§

impl Drop for AsyncClient

source§

fn drop(&mut self)

Executes the destructor for this 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, U> TryFrom<U> for T
where U: Into<T>,

§

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>,

§

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.