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

Methods

impl Protocol
[src]

[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());

[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]

[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]

[src]

This method tests for self and other values to be equal, and is used by ==. Read more

1.0.0
[src]

This method tests for !=.

impl Eq for Protocol
[src]

impl Clone for Protocol
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

impl Copy for Protocol
[src]

impl Debug for Protocol
[src]

[src]

Formats the value using the given formatter. Read more

impl From<Protocol> for u32
[src]

[src]

Performs the conversion.

impl From<Protocol> for u64
[src]

[src]

Performs the conversion.

impl ToString for Protocol
[src]

[src]

Converts the given value to a String. Read more

impl FromStr for Protocol
[src]

The associated error which can be returned from parsing.

[src]

Parses a string s to return a value of this type. Read more

Auto Trait Implementations

impl Send for Protocol

impl Sync for Protocol