Enum multiaddr::Protocol
[−]
[src]
#[repr(u32)]pub enum Protocol { IP4, TCP, UDP, DCCP, IP6, DNS4, DNS6, SCTP, UDT, UTP, UNIX, P2P, IPFS, HTTP, HTTPS, ONION, QUIC, WS, WSS, Libp2pWebsocketStar, Libp2pWebrtcStar, Libp2pWebrtcDirect, P2pCircuit, }
Protocol
A type to describe the possible protocol used in a Multiaddr. Protocol is the list of all possible protocols.
Variants
IP4
TCP
UDP
DCCP
IP6
DNS4
DNS6
SCTP
UDT
UTP
UNIX
P2P
IPFS
HTTP
HTTPS
ONION
QUIC
WS
WSS
Libp2pWebsocketStar
Libp2pWebrtcStar
Libp2pWebrtcDirect
P2pCircuit
Methods
impl Protocol
[src]
pub fn from(raw: u64) -> Result<Protocol>
[src]
Convert a u64
based code to a Protocol
.
Examples
use multiaddr::Protocol; assert_eq!(Protocol::from(6).unwrap(), Protocol::TCP); assert!(Protocol::from(455).is_err());
pub fn size(&self) -> ProtocolArgSize
[src]
Get the size from a Protocol
.
Examples
use multiaddr::Protocol; use multiaddr::ProtocolArgSize; assert_eq!(Protocol::TCP.size(), ProtocolArgSize::Fixed { bytes: 2 });
impl Protocol
[src]
pub fn parse_data(&self, a: &str) -> Result<AddrComponent>
[src]
Convert an array slice to the string representation.
Examples
use std::net::Ipv4Addr; use multiaddr::AddrComponent; use multiaddr::Protocol; let proto = Protocol::IP4; assert_eq!(proto.parse_data("127.0.0.1").unwrap(), AddrComponent::IP4(Ipv4Addr::new(127, 0, 0, 1)));
Trait Implementations
impl PartialEq for Protocol
[src]
fn eq(&self, __arg_0: &Protocol) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests for !=
.
impl Eq for Protocol
[src]
impl Clone for Protocol
[src]
fn clone(&self) -> Protocol
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Copy for Protocol
[src]
impl Debug for Protocol
[src]
fn fmt(&self, __arg_0: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more