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(u8, DtnAddress)
Ipn(u8, 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());
Check whether the EndpointID service name starts with ‘~’
Trait Implementations
Deserialize this value from the given Serde deserializer. Read more
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
This method tests for !=
.
type Error = EndpointIdError
type Error = EndpointIdError
The type returned in the event of a conversion error.
Performs the conversion.
Load EndpointID from URL string.
Support for ipn and dtn schemes.
Auto Trait Implementations
impl RefUnwindSafe for EndpointID
impl Send for EndpointID
impl Sync for EndpointID
impl Unpin for EndpointID
impl UnwindSafe for EndpointID
Blanket Implementations
Mutably borrows from an owned value. Read more