pub enum ProtocolVersion {
V1,
V2,
}Expand description
The relay protocol version negotiated between client and server.
Sent as the websocket sub-protocol header Sec-Websocket-Protocol from
the client. The server picks the best supported version and replies with it.
Variants are ordered by preference (highest first), so the Ord impl
can be used during negotiation to pick the best version.
Variants§
V1
Version 1 (the only version supported until iroh 0.98.0)
V2
Version 2 (added in iroh 0.98.0)
- Removed
Healthframe (id 11) - Added
Statusframe (id 13)
Implementations§
Source§impl ProtocolVersion
impl ProtocolVersion
Sourcepub fn all() -> impl Iterator<Item = &'static str>
pub fn all() -> impl Iterator<Item = &'static str>
Returns an iterator of all supported protocol version identifiers, in order of preference.
Sourcepub fn all_joined() -> String
pub fn all_joined() -> String
Returns a comma-separated string of all supported protocol version identifiers.
Sourcepub fn all_as_header_value() -> HeaderValue
pub fn all_as_header_value() -> HeaderValue
Returns all supported protocol versions in a comma-seperated string as an HTTP header value.
Sourcepub fn match_from_str(s: &str) -> Option<Self>
pub fn match_from_str(s: &str) -> Option<Self>
Tries to parse a ProtocolVersion from s.
Returns None if s is not a valid protocol version string.
Sourcepub fn to_header_value(&self) -> HeaderValue
pub fn to_header_value(&self) -> HeaderValue
Returns this protocol version as an HTTP header value.
Trait Implementations§
Source§impl Clone for ProtocolVersion
impl Clone for ProtocolVersion
Source§fn clone(&self) -> ProtocolVersion
fn clone(&self) -> ProtocolVersion
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ProtocolVersion
impl Debug for ProtocolVersion
Source§impl Default for ProtocolVersion
impl Default for ProtocolVersion
Source§fn default() -> ProtocolVersion
fn default() -> ProtocolVersion
Source§impl Display for ProtocolVersion
impl Display for ProtocolVersion
Source§impl<'_derivative_strum> From<&'_derivative_strum ProtocolVersion> for &'static str
impl<'_derivative_strum> From<&'_derivative_strum ProtocolVersion> for &'static str
Source§fn from(x: &'_derivative_strum ProtocolVersion) -> &'static str
fn from(x: &'_derivative_strum ProtocolVersion) -> &'static str
Source§impl From<ProtocolVersion> for &'static str
impl From<ProtocolVersion> for &'static str
Source§fn from(x: ProtocolVersion) -> &'static str
fn from(x: ProtocolVersion) -> &'static str
Source§impl FromStr for ProtocolVersion
impl FromStr for ProtocolVersion
Source§impl Ord for ProtocolVersion
impl Ord for ProtocolVersion
Source§fn cmp(&self, other: &ProtocolVersion) -> Ordering
fn cmp(&self, other: &ProtocolVersion) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for ProtocolVersion
impl PartialEq for ProtocolVersion
Source§impl PartialOrd for ProtocolVersion
impl PartialOrd for ProtocolVersion
Source§impl TryFrom<&str> for ProtocolVersion
impl TryFrom<&str> for ProtocolVersion
Source§impl VariantArray for ProtocolVersion
impl VariantArray for ProtocolVersion
impl Copy for ProtocolVersion
impl Eq for ProtocolVersion
impl StructuralPartialEq for ProtocolVersion
Auto Trait Implementations§
impl Freeze for ProtocolVersion
impl RefUnwindSafe for ProtocolVersion
impl Send for ProtocolVersion
impl Sync for ProtocolVersion
impl Unpin for ProtocolVersion
impl UnsafeUnpin for ProtocolVersion
impl UnwindSafe for ProtocolVersion
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.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> 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>
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>
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.