#[non_exhaustive]pub struct Handshake<D: RegisteredDriver> {
pub hello: D::Hello,
pub accept: Accept<D>,
}
Expand description
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.hello: D::Hello
The RegisteredDriver::Hello
message sent by the client to identify
the requested incoming connection.
accept: Accept<D>
Accepts or rejects the handshake.
The Handshake::accept
and Handshake::reject
methods may be used
to accept the handshake, but the Accept
type provides these methods
on a separate type, so that the Hello
message
can be moved out of the Handshake
value while still allowing the
connection to be accepted.
Implementations§
source§impl<D: RegisteredDriver> Handshake<D>
impl<D: RegisteredDriver> Handshake<D>
sourcepub fn accept(self, channel: KProducer<Message<D>>) -> Result<(), AcceptError>
pub fn accept(self, channel: KProducer<Message<D>>) -> Result<(), AcceptError>
Accept the connection, returning the provided channel
to the client.
Any requests sent by the client once the connection has been accepted
will now be received by the KConsumer
corresponding to the provided
KProducer
.
§Returns
Ok
(
[()
])
if the connection was successfully accepted.Err
(
AcceptError
)
if the connection was canceled by the client. In this case, the client is no longer interested in the connection (and may or may not still exist), and the service may ignore this connection request.
sourcepub fn reject(self, error: D::ConnectError) -> Result<(), AcceptError>
pub fn reject(self, error: D::ConnectError) -> Result<(), AcceptError>
Reject the connection, returning the provided error
to the client.
§Returns
Ok
(
[()
])
if the connection was successfully rejected and the error was received by the client.Err
(
AcceptError
)
if the connection was canceled by the client.
Auto Trait Implementations§
impl<D> Freeze for Handshake<D>
impl<D> !RefUnwindSafe for Handshake<D>
impl<D> Send for Handshake<D>where
<D as RegisteredDriver>::Hello: Send,
<D as RegisteredDriver>::ConnectError: Send,
<D as RegisteredDriver>::Request: Send,
<D as RegisteredDriver>::Response: Send,
<D as RegisteredDriver>::Error: Send,
impl<D> Sync for Handshake<D>where
<D as RegisteredDriver>::Hello: Sync,
<D as RegisteredDriver>::ConnectError: Send,
<D as RegisteredDriver>::Request: Send,
<D as RegisteredDriver>::Response: Send,
<D as RegisteredDriver>::Error: Send,
impl<D> Unpin for Handshake<D>
impl<D> !UnwindSafe for Handshake<D>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Casts the value.
source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Casts the value.
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
source§impl<T> OverflowingAs for T
impl<T> OverflowingAs for T
source§fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
Casts the value.
source§impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
source§fn overflowing_cast_from(src: Src) -> (Dst, bool)
fn overflowing_cast_from(src: Src) -> (Dst, bool)
Casts the value.
source§impl<T> SaturatingAs for T
impl<T> SaturatingAs for T
source§fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
Casts the value.
source§impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
source§fn saturating_cast_from(src: Src) -> Dst
fn saturating_cast_from(src: Src) -> Dst
Casts the value.
source§impl<T> UnwrappedAs for T
impl<T> UnwrappedAs for T
source§fn unwrapped_as<Dst>(self) -> Dstwhere
T: UnwrappedCast<Dst>,
fn unwrapped_as<Dst>(self) -> Dstwhere
T: UnwrappedCast<Dst>,
Casts the value.
source§impl<Src, Dst> UnwrappedCastFrom<Src> for Dstwhere
Src: UnwrappedCast<Dst>,
impl<Src, Dst> UnwrappedCastFrom<Src> for Dstwhere
Src: UnwrappedCast<Dst>,
source§fn unwrapped_cast_from(src: Src) -> Dst
fn unwrapped_cast_from(src: Src) -> Dst
Casts the value.
source§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
source§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
source§fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ
fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ
source§impl<T> WrappingAs for T
impl<T> WrappingAs for T
source§fn wrapping_as<Dst>(self) -> Dstwhere
T: WrappingCast<Dst>,
fn wrapping_as<Dst>(self) -> Dstwhere
T: WrappingCast<Dst>,
Casts the value.
source§impl<Src, Dst> WrappingCastFrom<Src> for Dstwhere
Src: WrappingCast<Dst>,
impl<Src, Dst> WrappingCastFrom<Src> for Dstwhere
Src: WrappingCast<Dst>,
source§fn wrapping_cast_from(src: Src) -> Dst
fn wrapping_cast_from(src: Src) -> Dst
Casts the value.