Enum bp7::eid::EndpointID[][src]

pub enum EndpointID {
    Dtn(u8, DtnAddress),
    DtnNone(u8, u8),
    Ipn(u8, IpnAddress),
}
Expand description

Represents an endpoint in various addressing schemes.

Either the none endpoint, a dtn one or an ipn endpoint.

Variants

Dtn

Tuple Fields of Dtn

0: u81: DtnAddress
DtnNone

Tuple Fields of DtnNone

0: u81: u8
Ipn

Tuple Fields of Ipn

0: u81: IpnAddress

Implementations

Default returns a dtn:none endpoint

Create a new EndpointID with dtn addressing scheme

This can either be a host id such as dtn://node1/ or include an application agents endpoint, e.g., dtn://node1/endpoint1 or for non-singletons dtn://group1/~endpoint1

Create a new ‘dtn:none’ endpoint

This is the same as DTN_NONE

Create a new EndpointID with ipn addressing scheme

This can either be a host id such as ‘ipn:23.0’ or include an application agents endpoint, e.g., ‘ipn:23.42’

host must be > 0

Generate a new Endpoint ID from existing one with a specific service endpoint

Keeps scheme and host specific parts from original eid.

Examples

use bp7::eid::*;

// For ipn addresses

let ipn_addr_1 = EndpointID::with_ipn(23, 42).unwrap();
let ipn_addr_2 = EndpointID::with_ipn(23, 7).unwrap();

assert_eq!(ipn_addr_1, ipn_addr_2.new_endpoint("42").unwrap());

let ipn_addr_1 = EndpointID::with_ipn(23, 42).unwrap();    

assert!(ipn_addr_1.new_endpoint("-42").is_err());    

// For dtn addresses
let dtn_addr_1 = EndpointID::with_dtn( "//node1/incoming").unwrap();
let dtn_addr_2 = EndpointID::with_dtn( "//node1/inbox").unwrap();

assert_eq!(dtn_addr_1, dtn_addr_2.new_endpoint("incoming").unwrap());

// For non endpoint this is not possible

let dtn_addr_none = EndpointID::none();    

assert!(dtn_addr_none.new_endpoint("incoming").is_err());    
    

Returns the plain node name without URL scheme

Returns the node name including URL scheme

Check whether the EndpointID service name starts with ‘~’

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Deserialize this value from the given Serde deserializer. Read more

Formats the value using the given formatter. Read more

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

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

This method tests for !=.

Serialize this value into the given Serde serializer. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Load EndpointID from URL string.

Support for ipn and dtn schemes.

The type returned in the event of a conversion error.

Performs the conversion.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.