Struct ClientBuilder

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

Builder for Client.

Use this to specify additional options when connecting to an OPC UA endpoint.

§Examples

use open62541::ClientBuilder;
use std::time::Duration;

let client = ClientBuilder::default()
    .secure_channel_life_time(Duration::from_secs(60))
    .connect("opc.tcp://opcuademo.sterfive.com:26543")?;

Implementations§

Source§

impl ClientBuilder

Source

pub fn timeout(self, timeout: Duration) -> Self

Sets (response) timeout.

§Panics

The given duration must be non-negative and less than 4,294,967,295 milliseconds (less than 49.7 days).

Source

pub fn client_description( self, client_description: ApplicationDescription, ) -> Self

Sets client description.

The description must be internally consistent. The application URI set in the application description must match the URI set in the certificate.

Source

pub fn user_identity_token( self, user_identity_token: &UserIdentityToken, ) -> Self

Sets user identity token.

Source

pub fn security_mode(self, security_mode: MessageSecurityMode) -> Self

Sets security mode.

Source

pub fn security_policy_uri(self, security_policy_uri: String) -> Self

Sets security policy URI.

The known values are as follows:

  • http://opcfoundation.org/UA/SecurityPolicy#None
  • http://opcfoundation.org/UA/SecurityPolicy#Basic128Rsa15 (deprecated)
  • http://opcfoundation.org/UA/SecurityPolicy#Basic256 (deprecated)
  • http://opcfoundation.org/UA/SecurityPolicy#Basic256Sha256
  • http://opcfoundation.org/UA/SecurityPolicy#Aes128_Sha256_RsaOaep
  • http://opcfoundation.org/UA/SecurityPolicy#Aes256_Sha256_RsaPss
Source

pub fn secure_channel_life_time( self, secure_channel_life_time: Duration, ) -> Self

Sets secure channel life time.

After this life time, the channel needs to be renewed.

§Panics

The given duration must be non-negative and less than 4,294,967,295 milliseconds (less than 49.7 days).

Source

pub fn requested_session_timeout( self, requested_session_timeout: Duration, ) -> Self

Sets requested session timeout.

§Panics

The given duration must be non-negative and less than 4,294,967,295 milliseconds (less than 49.7 days).

Source

pub fn connectivity_check_interval( self, connectivity_check_interval: Option<Duration>, ) -> Self

Sets connectivity check interval.

Use None to disable background task.

§Panics

The given duration must be non-negative and less than 4,294,967,295 milliseconds (less than 49.7 days).

Source

pub fn accept_all(self) -> Self

Disables server certificate checks.

Note that this disables all certificate verification of server communications. Use only when servers can be identified in some other way, or identity is not relevant.

This is a shortcut for using certificate_verification() with ua::CertificateVerification::accept_all().

Source

pub fn certificate_verification( self, certificate_verification: CertificateVerification, ) -> Self

Sets certificate verification.

Source

pub fn connect(self, endpoint_url: &str) -> Result<Client>

Connects to OPC UA endpoint and returns Client.

§Errors

This fails when the target server is not reachable.

§Panics

The endpoint URL must not contain any NUL bytes.

Source

pub fn get_endpoints( self, server_url: &str, ) -> Result<Array<EndpointDescription>>

Connects to OPC UA server and returns endpoints.

§Errors

This fails when the target server is not reachable.

§Panics

The server URL must not contain any NUL bytes.

Trait Implementations§

Source§

impl Debug for ClientBuilder

Source§

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

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

impl Default for ClientBuilder

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