pub struct ProtocolId(pub [u8; 16]);Expand description
Protocol identifier for multiplexing multiple overlays on a single transport.
Protocols are identified by a 16-byte value, allowing efficient binary comparison while supporting human-readable names during debugging.
§Examples
use ant_quic::link_transport::ProtocolId;
// From a static string (padded/truncated to 16 bytes)
const DHT: ProtocolId = ProtocolId::from_static(b"saorsa-dht/1.0.0");
// From bytes
let proto = ProtocolId::new([0x73, 0x61, 0x6f, 0x72, 0x73, 0x61, 0x2d, 0x64,
0x68, 0x74, 0x2f, 0x31, 0x2e, 0x30, 0x2e, 0x30]);Tuple Fields§
§0: [u8; 16]Implementations§
Source§impl ProtocolId
impl ProtocolId
Sourcepub const DEFAULT: Self
pub const DEFAULT: Self
The default protocol for connections without explicit protocol negotiation.
Sourcepub const NAT_TRAVERSAL: Self
pub const NAT_TRAVERSAL: Self
Protocol ID for NAT traversal coordination messages.
Sourcepub const fn from_static(s: &[u8]) -> Self
pub const fn from_static(s: &[u8]) -> Self
Create a protocol ID from a static byte string.
The string is padded with zeros if shorter than 16 bytes, or truncated if longer.
Trait Implementations§
Source§impl Clone for ProtocolId
impl Clone for ProtocolId
Source§fn clone(&self) -> ProtocolId
fn clone(&self) -> ProtocolId
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 Debug for ProtocolId
impl Debug for ProtocolId
Source§impl Default for ProtocolId
impl Default for ProtocolId
Source§impl Display for ProtocolId
impl Display for ProtocolId
Source§impl From<&str> for ProtocolId
impl From<&str> for ProtocolId
Source§impl Hash for ProtocolId
impl Hash for ProtocolId
Source§impl PartialEq for ProtocolId
impl PartialEq for ProtocolId
impl Copy for ProtocolId
impl Eq for ProtocolId
impl StructuralPartialEq for ProtocolId
Auto Trait Implementations§
impl Freeze for ProtocolId
impl RefUnwindSafe for ProtocolId
impl Send for ProtocolId
impl Sync for ProtocolId
impl Unpin for ProtocolId
impl UnwindSafe for ProtocolId
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,
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
Compare self to
key and return true if they are equal.