pub struct Browser<'a, T, R> { /* private fields */ }
Expand description
A utility for recursively discovering nodes on an OPC-UA server.
Implementations§
Source§impl<'a, T: BrowserPolicy + 'a, R: RequestRetryPolicy + Clone + 'a> Browser<'a, T, R>
impl<'a, T: BrowserPolicy + 'a, R: RequestRetryPolicy + Clone + 'a> Browser<'a, T, R>
Sourcepub fn run(
self,
initial: Vec<BrowseDescription>,
) -> impl Stream<Item = Result<BrowseResultItem, Error>> + 'a
pub fn run( self, initial: Vec<BrowseDescription>, ) -> impl Stream<Item = Result<BrowseResultItem, Error>> + 'a
Start the browser, returning a stream of results.
To stop browsing you can simply stop polling this stream.
Sourcepub async fn run_into_result(
self,
initial: Vec<BrowseDescription>,
) -> Result<BrowserResult, Error>
pub async fn run_into_result( self, initial: Vec<BrowseDescription>, ) -> Result<BrowserResult, Error>
Run the browser, collecting the results into a BrowserResult struct.
Source§impl<'a, T, R> Browser<'a, T, R>
impl<'a, T, R> Browser<'a, T, R>
Sourcepub fn new(session: &'a Session, handler: T, retry_policy: R) -> Self
pub fn new(session: &'a Session, handler: T, retry_policy: R) -> Self
Create a new browser with the given handler and retry policy.
Sourcepub fn handler<T2: BrowserPolicy + 'a>(
self,
new_handler: T2,
) -> Browser<'a, T2, R>
pub fn handler<T2: BrowserPolicy + 'a>( self, new_handler: T2, ) -> Browser<'a, T2, R>
Set a new browser policy. This is used to generate new browses after each visited node. Note that no matter what, a node will only be browsed once in each direction. (Or once in both at the same time).
Sourcepub fn retry_policy<R2: RequestRetryPolicy + Clone + 'a>(
self,
new_retry_policy: R2,
) -> Browser<'a, T, R2>
pub fn retry_policy<R2: RequestRetryPolicy + Clone + 'a>( self, new_retry_policy: R2, ) -> Browser<'a, T, R2>
Set a new request retry policy.
Sourcepub fn token(self, token: CancellationToken) -> Self
pub fn token(self, token: CancellationToken) -> Self
Set a new cancellation token. Once this is cancelled, the browser will try to shut down gracefully, which means waiting for any pending requests and then releasing continuation points.
If you don’t care about that (for example if you are shutting down the session soon), then you can just stop polling to the stream.
Sourcepub fn max_nodes_per_request(self, max_nodes_per_request: usize) -> Self
pub fn max_nodes_per_request(self, max_nodes_per_request: usize) -> Self
Set the maximum number of nodes per request sent to the server.
Note that the browser makes no guarantee that all requests sent will be as large as possible.
Sourcepub fn max_references_per_node(self, max_references_per_node: u32) -> Self
pub fn max_references_per_node(self, max_references_per_node: u32) -> Self
Set the maximum number of references requested per node. Can be 0 to let the server decide.
Sourcepub fn max_concurrent_requests(self, max_concurrent_requests: usize) -> Self
pub fn max_concurrent_requests(self, max_concurrent_requests: usize) -> Self
Set the maximum number of concurrent requests. Defaults to 1.
Sourcepub fn max_continuation_point_retries(
self,
max_continuation_point_retries: usize,
) -> Self
pub fn max_continuation_point_retries( self, max_continuation_point_retries: usize, ) -> Self
Set the maximum number of times a browse will be retried if the continuation point becomes invalid while the browser is running.
This will start the browse process over from zero for the affected node, meaning that the same references will be returned multiple times.
Sourcepub fn config(self, config: BrowserConfig) -> Self
pub fn config(self, config: BrowserConfig) -> Self
Set the browse configuration.