[][src]Enum multiaddr::Protocol

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

IP4TCPUDPDCCPIP6DNS4DNS6SCTPUDTUTPUNIXP2PIPFSHTTPHTTPSONIONQUICWSWSSLibp2pWebsocketStarLibp2pWebrtcStarLibp2pWebrtcDirectP2pCircuit

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<Protocol> for Protocol
[src]

#[must_use]
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_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl From<Protocol> for u32
[src]

impl From<Protocol> for u64
[src]

impl Copy for Protocol
[src]

impl Display for Protocol
[src]

impl Debug for Protocol
[src]

impl FromStr for Protocol
[src]

type Err = Error

The associated error which can be returned from parsing.

Auto Trait Implementations

impl Send for Protocol

impl Sync for Protocol

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

impl<T> From for T
[src]

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom for T where
    T: From<U>, 
[src]

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T> Same for T

type Output = T

Should always be Self