pub struct Client<Sock, Target> { /* private fields */ }
Expand description

An RTR client.

The client wraps a socket – represented by the type argument Sock which needs to support Tokio’s asynchronous writing and reading – and runs an RTR client over it. All data received will be passed on a VrpTarget of type Target.

The client keeps the socket open until either the server closes the connection, an error happens, or the client is dropped. It will periodically push a new dataset to the target.

Implementations

Creates a new client.

The client will use sock for communicating with the server and target to send updates to.

If the last state of a connection with this server is known – it can be determined by calling state on the client – it can be reused via the state argument. Make sure to also have the matching data in your target in this case since the there will not necessarily be a reset update. If you don’t have any state or don’t want to reuse an earlier session, simply pass None.

Returns a reference to the target.

Returns a mutable reference to the target.

Converts the client into its target.

Returns the current state of the session.

The method will return None if there hasn’t been initial state and there has not been any converstation with the server yet.

Runs the client.

The method will keep the client asynchronously running, fetching any new data that becomes available on the server and pushing it to the target until either the server closes the connection – in which case the method will return Ok(()) –, an error happens – which will be returned or the future gets dropped.

Performs a single update of the client data.

The method will wait until the next update is due and the request one single update from the server. It will request a new update object from the target, apply the update to that object and, if the update succeeds, return the object.

Performs a reset query.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.