#[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,
}
A type to describe the possible protocol used in a
Multiaddr.
Protocol is the list of all possible protocols.
Convert a u64
based code to a Protocol
.
use multiaddr::Protocol;
assert_eq!(Protocol::from(6).unwrap(), Protocol::TCP);
assert!(Protocol::from(455).is_err());
Get the size from a Protocol
.
use multiaddr::Protocol;
use multiaddr::ProtocolArgSize;
assert_eq!(Protocol::TCP.size(), ProtocolArgSize::Fixed { bytes: 2 });
Convert an array slice to the string representation.
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)));
This method tests for self
and other
values to be equal, and is used by ==
. Read more
This method tests for !=
.
Performs copy-assignment from source
. Read more
Formats the value using the given formatter. Read more
Formats the value using the given formatter. Read more
The associated error which can be returned from parsing.
Parses a string s
to return a value of this type. Read more
Creates owned data from borrowed data, usually by cloning. Read more
🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
Converts the given value to a String
. Read more
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
Immutably borrows from an owned value. Read more
🔬 This is a nightly-only experimental API. (get_type_id
)
this method will likely be replaced by an associated static
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
Mutably borrows from an owned value. Read more