Skip to main content

Handshake

Enum Handshake 

Source
pub enum Handshake<T>{
    Client(ClientHandshake),
    Server(ServerHandshake<T>),
}
Expand description

A merged handshake state that can be used by both the client and the server.

For convenience, a unified Handshake` should be used, which will internally choose the corresponding behavior based on the role.

Variants§

§

Client(ClientHandshake)

The client’s handshake state if the endpoint is a client.

§

Server(ServerHandshake<T>)

The server’s handshake state if the endpoint is a server.

Implementations§

Source§

impl<T> Handshake<T>

Source

pub fn new(role: Role, output: T) -> Self

Create a new handshake state, based on the role.

Source

pub fn new_client() -> Self

Create a new client handshake state.

Source

pub fn new_server(output: T) -> Self

Create a new server handshake state. The output is responsible for sending the HandshakeDoneFrame to the client, see ServerHandshake::new.

Source

pub fn is_handshake_done(&self) -> bool

Check if the handshake is complete.

Source

pub fn done(&self) -> bool

Set the handshake status to complete(for server)

For client, this method does nothing and always returns false.

This method return true when it first time set the handshake status to complete.

Source

pub fn role(&self) -> Role

Return the role of this handshake signal.

Trait Implementations§

Source§

impl<T> Clone for Handshake<T>

Source§

fn clone(&self) -> Handshake<T>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T> Debug for Handshake<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T> ReceiveFrame<HandshakeDoneFrame> for Handshake<T>

Source§

fn recv_frame(&self, frame: HandshakeDoneFrame) -> Result<bool, Error>

Receive the HandshakeDoneFrame.

A HandshakeDoneFrame can only be received by the client. A server MUST treat receipt of a HandshakeDoneFrame as a connection error of type PROTOCOL_VIOLATION. See section 19.20 of QUIC.

Return whether it is the first time to receive the HANDSHAKE_DONE frame(for client).

Source§

type Output = bool

Auto Trait Implementations§

§

impl<T> Freeze for Handshake<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for Handshake<T>
where T: RefUnwindSafe,

§

impl<T> Send for Handshake<T>
where T: Send,

§

impl<T> Sync for Handshake<T>
where T: Sync,

§

impl<T> Unpin for Handshake<T>
where T: Unpin,

§

impl<T> UnsafeUnpin for Handshake<T>
where T: UnsafeUnpin,

§

impl<T> UnwindSafe for Handshake<T>
where T: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more