Struct zbus::handshake::ServerHandshake
source · [−]pub struct ServerHandshake<S> { /* private fields */ }
Expand description
A representation of an in-progress handshake, server-side
This would typically be used to implement a D-Bus broker, or in the context of a P2P connection.
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
sourceimpl<S: Socket> ServerHandshake<S>
impl<S: Socket> ServerHandshake<S>
pub fn new(socket: S, guid: Guid, client_uid: u32) -> ServerHandshake<S>
sourcepub fn advance_handshake(&mut self) -> Result<()>
pub fn advance_handshake(&mut self) -> Result<()>
Same as Handshake::advance_handshake
. Only exists for backwards compatibility.
sourcepub fn try_finish(self) -> Result<Authenticated<S>, Self>
pub fn try_finish(self) -> Result<Authenticated<S>, Self>
Same as Handshake::try_finish
. Only exists for backwards compatibility.
sourcepub fn socket(&self) -> &S
pub fn socket(&self) -> &S
Same as Handshake::socket
. Only exists for backwards compatibility.
sourceimpl ServerHandshake<UnixStream>
impl ServerHandshake<UnixStream>
sourcepub fn blocking_finish(self) -> Result<Authenticated<UnixStream>>
pub fn blocking_finish(self) -> Result<Authenticated<UnixStream>>
Block and automatically drive the handshake for this server
This method will block until the handshake is finalized, even if the socket is in non-blocking mode.
Trait Implementations
sourceimpl<S: Debug> Debug for ServerHandshake<S>
impl<S: Debug> Debug for ServerHandshake<S>
sourceimpl<S: Socket> Handshake<S> for ServerHandshake<S>
impl<S: Socket> Handshake<S> for ServerHandshake<S>
sourcefn next_io_operation(&self) -> IoOperation
fn next_io_operation(&self) -> IoOperation
The next I/O operation needed for advancing the handshake. Read more
sourcefn advance_handshake(&mut self) -> Result<()>
fn advance_handshake(&mut self) -> Result<()>
Attempt to advance the handshake Read more
sourcefn try_finish(self) -> Result<Authenticated<S>, Self>
fn try_finish(self) -> Result<Authenticated<S>, Self>
Attempt to finalize this handshake into an initialized client. Read more
Auto Trait Implementations
impl<S> RefUnwindSafe for ServerHandshake<S> where
S: RefUnwindSafe,
impl<S> Send for ServerHandshake<S> where
S: Send,
impl<S> Sync for ServerHandshake<S> where
S: Sync,
impl<S> Unpin for ServerHandshake<S> where
S: Unpin,
impl<S> UnwindSafe for ServerHandshake<S> where
S: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more