[−][src]Struct zbus::handshake::ClientHandshake
A representation of an in-progress handshake, client-side
This struct is an async-compatible representation of the initial handshake that must be performed before
a D-Bus connection can be used. To use it, you should call the advance_handshake
method whenever the
underlying socket becomes ready (tracking the readiness itself is not managed by this abstraction) until
it returns Ok(())
, at which point you can invoke the try_finish
method to get an Authenticated
,
which can be given to Connection::new_authenticated
.
If handling the handshake asynchronously is not necessary, the blocking_finish
method is provided
which blocks until the handshake is completed or an error occurs.
Implementations
impl<S: Socket> ClientHandshake<S>
[src]
pub fn new(socket: S) -> ClientHandshake<S>
[src]
Start a handsake on this client socket
pub fn advance_handshake(&mut self) -> Result<()>
[src]
Attempt to advance the handshake
In non-blocking mode, you need to invoke this method repeatedly
until it returns Ok(())
. Once it does, the handshake is finished
and you can invoke the [try_finish
] method.
Note that only the intial handshake is done. If you need to send a Bus Hello, this remains to be done.
pub fn try_finish(self) -> Result<Authenticated<S>, Self>
[src]
Attempt to finalize this handshake into an initialized client.
This method should only be called once advance_handshake()
has
returned Ok(())
. Otherwise it'll error and return you the object.
pub fn socket(&self) -> &S
[src]
Access the socket backing this handshake
Would typically be used to register it for readiness.
impl ClientHandshake<UnixStream>
[src]
pub fn new_session() -> Result<Self>
[src]
Initialize a handshake to the session/user message bus.
The socket backing this connection is created in blocking mode.
pub fn new_session_nonblock() -> Result<Self>
[src]
Initialize a handshake to the session/user message bus.
The socket backing this connection is created in non-blocking mode.
pub fn new_system() -> Result<Self>
[src]
Initialize a handshake to the system-wide message bus.
The socket backing this connection is created in blocking mode.
pub fn new_system_nonblock() -> Result<Self>
[src]
Initialize a handshake to the system-wide message bus.
The socket backing this connection is created in non-blocking mode.
pub fn new_for_address(address: &str) -> Result<Self>
[src]
Create a handshake for the given D-Bus address.
The socket backing this connection is created in blocking mode.
pub fn new_for_address_nonblock(address: &str) -> Result<Self>
[src]
Create a handshake for the given D-Bus address.
The socket backing this connection is created in non-blocking mode.
pub fn blocking_finish(self) -> Result<Authenticated<UnixStream>>
[src]
Block and automatically drive the handshake for this client
This method will block until the handshake is finalized, even if the socket is in non-blocking mode.
Trait Implementations
Auto Trait Implementations
impl<S> RefUnwindSafe for ClientHandshake<S> where
S: RefUnwindSafe,
S: RefUnwindSafe,
impl<S> Send for ClientHandshake<S> where
S: Send,
S: Send,
impl<S> Sync for ClientHandshake<S> where
S: Sync,
S: Sync,
impl<S> Unpin for ClientHandshake<S> where
S: Unpin,
S: Unpin,
impl<S> UnwindSafe for ClientHandshake<S> where
S: UnwindSafe,
S: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,