pub enum StartProtocol<I, T, C> {
StartSession(StartInitiation<T, C>),
SessionEstablished(StartEstablished<I>),
SessionError(StartErrorType),
KeepAlive(KeepAliveMessage<I>),
}
Expand description
Lists all messages of the Start protocol for a session establishment.
§Generic parameters
I
is the session identifier.T
is the session target.C
are session capabilities.
§Diagram of the protocol
sequenceDiagram
Entry->>Exit: SessionInitiation (Challenge)
alt If Exit can accept a new session
Note right of Exit: SessionID [Pseudonym, Tag]
Exit->>Entry: SessionEstablished (Challenge, SessionID_Entry)
Note left of Entry: SessionID [Pseudonym, Tag]
Entry->>Exit: KeepAlive (SessionID)
Note over Entry,Exit: Data
else If Exit cannot accept a new session
Exit->>Entry: SessionError (Challenge, Reason)
end
opt If initiation attempt times out
Note left of Entry: Failure
end
Variants§
StartSession(StartInitiation<T, C>)
Request to initiate a new session.
SessionEstablished(StartEstablished<I>)
Confirmation that a new session has been established by the counterparty.
SessionError(StartErrorType)
Counterparty could not establish a new session due to an error.
KeepAlive(KeepAliveMessage<I>)
A ping message to keep the session alive.
Implementations§
Source§impl<I, T, C> StartProtocol<I, T, C>
impl<I, T, C> StartProtocol<I, T, C>
Sourcepub const START_PROTOCOL_MESSAGE_TAG: Tag
pub const START_PROTOCOL_MESSAGE_TAG: Tag
Fixed [Tag
] of every protocol message.
Sourcepub const START_PROTOCOL_VERSION: u8 = 2u8
pub const START_PROTOCOL_VERSION: u8 = 2u8
Current version of the Start protocol.
Source§impl<I, T, C> StartProtocol<I, T, C>where
I: Serialize + for<'de> Deserialize<'de>,
T: Serialize + for<'de> Deserialize<'de>,
C: Into<u8> + TryFrom<u8>,
impl<I, T, C> StartProtocol<I, T, C>where
I: Serialize + for<'de> Deserialize<'de>,
T: Serialize + for<'de> Deserialize<'de>,
C: Into<u8> + TryFrom<u8>,
Sourcepub fn encode(self) -> Result<(Tag, Box<[u8]>)>
pub fn encode(self) -> Result<(Tag, Box<[u8]>)>
Tries to encode the message into binary format and [Tag
]
Sourcepub fn decode(tag: Tag, data: &[u8]) -> Result<Self>
pub fn decode(tag: Tag, data: &[u8]) -> Result<Self>
Tries to decode the message from the binary representation and [Tag
].
The tag
must be currently START_PROTOCOL_MESSAGE_TAG
and version START_PROTOCOL_VERSION
.
Trait Implementations§
Source§impl<I: Clone, T: Clone, C: Clone> Clone for StartProtocol<I, T, C>
impl<I: Clone, T: Clone, C: Clone> Clone for StartProtocol<I, T, C>
Source§fn clone(&self) -> StartProtocol<I, T, C>
fn clone(&self) -> StartProtocol<I, T, C>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl<'_enum, I, T, C> From<&'_enum StartProtocol<I, T, C>> for StartProtocolDiscriminants
impl<'_enum, I, T, C> From<&'_enum StartProtocol<I, T, C>> for StartProtocolDiscriminants
Source§fn from(val: &'_enum StartProtocol<I, T, C>) -> StartProtocolDiscriminants
fn from(val: &'_enum StartProtocol<I, T, C>) -> StartProtocolDiscriminants
Converts to this type from the input type.
Source§impl<I, T, C> From<StartProtocol<I, T, C>> for StartProtocolDiscriminants
impl<I, T, C> From<StartProtocol<I, T, C>> for StartProtocolDiscriminants
Source§fn from(val: StartProtocol<I, T, C>) -> StartProtocolDiscriminants
fn from(val: StartProtocol<I, T, C>) -> StartProtocolDiscriminants
Converts to this type from the input type.
Source§impl<I, T, C> IntoDiscriminant for StartProtocol<I, T, C>
impl<I, T, C> IntoDiscriminant for StartProtocol<I, T, C>
Source§type Discriminant = StartProtocolDiscriminants
type Discriminant = StartProtocolDiscriminants
Enum listing the same variants as this enum but without any data fields
fn discriminant(&self) -> Self::Discriminant
Source§impl<I, T, C> TryFrom<ApplicationData> for StartProtocol<I, T, C>where
I: Serialize + for<'de> Deserialize<'de>,
T: Serialize + for<'de> Deserialize<'de>,
C: Into<u8> + TryFrom<u8>,
impl<I, T, C> TryFrom<ApplicationData> for StartProtocol<I, T, C>where
I: Serialize + for<'de> Deserialize<'de>,
T: Serialize + for<'de> Deserialize<'de>,
C: Into<u8> + TryFrom<u8>,
Source§impl<I, T, C> TryFrom<StartProtocol<I, T, C>> for ApplicationDatawhere
I: Serialize + for<'de> Deserialize<'de>,
T: Serialize + for<'de> Deserialize<'de>,
C: Into<u8> + TryFrom<u8>,
impl<I, T, C> TryFrom<StartProtocol<I, T, C>> for ApplicationDatawhere
I: Serialize + for<'de> Deserialize<'de>,
T: Serialize + for<'de> Deserialize<'de>,
C: Into<u8> + TryFrom<u8>,
Source§type Error = StartProtocolError
type Error = StartProtocolError
The type returned in the event of a conversion error.
impl<I: Eq, T: Eq, C: Eq> Eq for StartProtocol<I, T, C>
impl<I, T, C> StructuralPartialEq for StartProtocol<I, T, C>
Auto Trait Implementations§
impl<I, T, C> Freeze for StartProtocol<I, T, C>
impl<I, T, C> RefUnwindSafe for StartProtocol<I, T, C>
impl<I, T, C> Send for StartProtocol<I, T, C>
impl<I, T, C> Sync for StartProtocol<I, T, C>
impl<I, T, C> Unpin for StartProtocol<I, T, C>
impl<I, T, C> UnwindSafe for StartProtocol<I, T, C>
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more