Struct rdftk_iri::Port[][src]

pub struct Port(_);

This type represents the port component, it is a 16 bit unsigned integer.

Examples

use rdftk_iri::Port;
use std::str::FromStr;

let http_port: Port = Port::from_str("80").unwrap();

let https_port: Port = 443.into();

A number of well-known ports are also provided as associated functions on the Port implementation for convenience.

use rdftk_iri::Port;
use rdftk_iri::Scheme;

let http_port: Port = Port::http();

let https_port: Port = Port::default_for(&Scheme::https()).unwrap();

Finally, there is a difference between to_string that will format the value for inclusion in an IRI string, and value that returns the raw port integer.

use rdftk_iri::Port;

let http_port: Port = Port::new(80);

println!("'{}'", http_port); // prints '80'
println!("'{}'", http_port.value()); // prints '80'

Implementations

impl Port[src]

pub fn new(raw_port: u16) -> Self[src]

Construct a new Port instance from the raw port value.

pub fn ftp_data() -> Port[src]

Well-known port for FTP protocol.

pub fn ftp_control() -> Port[src]

Well-known port for FTP protocol.

pub fn ssh() -> Port[src]

Well-known port for SSH protocol.

pub fn telnet() -> Port[src]

Well-known port for Telnet protocol.

pub fn tftp() -> Port[src]

Well-known port for TFTP protocol.

pub fn gopher() -> Port[src]

Well-known port for Gopher protocol.

pub fn http() -> Port[src]

Well-known port for HTTP protocol.

pub fn nntp() -> Port[src]

Well-known port for NNTP protocol.

pub fn imap() -> Port[src]

Well-known port for IMAP protocol.

pub fn snmp() -> Port[src]

Well-known port for SNMP protocol.

pub fn snmp_trap() -> Port[src]

Well-known port for SNMP protocol.

pub fn imap3() -> Port[src]

Well-known port for IMAP protocol.

pub fn ldap() -> Port[src]

Well-known port for LDAP protocol.

pub fn https() -> Port[src]

Well-known port for HTTPS protocol.

pub fn rtsp() -> Port[src]

Well-known port for RTSP protocol.

pub fn ipp() -> Port[src]

Well-known port for IPP protocol.

pub fn iris_beep() -> Port[src]

Well-known port for BEEP protocol.

pub fn dict() -> Port[src]

Well-known port for Dict protocol.

pub fn stun() -> Port[src]

Well-known port for STUN protocol.

pub fn diameter() -> Port[src]

Well-known port for Diameter protocol.

pub fn iax() -> Port[src]

Well-known port for IAX protocol.

pub fn sip() -> Port[src]

Well-known port for SIP protocol.

pub fn sips() -> Port[src]

Well-known port for SIPS protocol.

pub fn vnc() -> Port[src]

Well-known port for VNC protocol.

pub fn coap() -> Port[src]

Well-known port for COAP protocol.

pub fn coaps() -> Port[src]

Well-known port for COAP protocol.

pub fn default_for(scheme: &Scheme) -> Option<Port>[src]

Return the default port for the provided Scheme, if one is known.

pub fn value(&self) -> &u16[src]

Return the raw port value.

Trait Implementations

impl Clone for Port[src]

impl Debug for Port[src]

impl Display for Port[src]

impl Eq for Port[src]

impl From<u16> for Port[src]

impl FromStr for Port[src]

type Err = IriError

The associated error which can be returned from parsing.

impl Hash for Port[src]

impl PartialEq<Port> for Port[src]

impl StructuralEq for Port[src]

impl StructuralPartialEq for Port[src]

Auto Trait Implementations

impl RefUnwindSafe for Port

impl Send for Port

impl Sync for Port

impl Unpin for Port

impl UnwindSafe for Port

Blanket Implementations

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

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

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

impl<T> From<T> for T[src]

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

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

type Owned = T

The resulting type after obtaining ownership.

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

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

The type returned in the event of a conversion error.