[−][src]Enum bp7::eid::EndpointID
Represents an endpoint in various addressing schemes.
Either the none endpoint, a dtn one or an ipn endpoint.
Variants
Ipn(u8, IpnAddress)
Implementations
impl EndpointID
[src]
pub fn new() -> EndpointID
[src]
Default returns a dtn:none
endpoint
pub fn with_dtn(host_with_endpoint: &str) -> Result<EndpointID, EndpointIdError>
[src]
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
pub const fn none() -> EndpointID
[src]
Create a new 'dtn:none' endpoint
This is the same as DTN_NONE
pub fn with_ipn(host: u64, endpoint: u64) -> Result<EndpointID, EndpointIdError>
[src]
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
pub fn new_endpoint(&self, ep: &str) -> Result<EndpointID, EndpointIdError>
[src]
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());
pub fn scheme(&self) -> String
[src]
pub fn scheme_specific_part_dtn(&self) -> Option<String>
[src]
pub fn scheme_specific_part_ipn(&self) -> Option<IpnAddress>
[src]
impl EndpointID
[src]
pub fn node(&self) -> Option<String>
[src]
Returns the plain node name without URL scheme
pub fn node_id(&self) -> Option<String>
[src]
Returns the node name including URL scheme
pub fn is_node_id(&self) -> bool
[src]
pub fn validate(&self) -> Result<(), EndpointIdError>
[src]
Trait Implementations
impl Clone for EndpointID
[src]
fn clone(&self) -> EndpointID
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for EndpointID
[src]
impl Default for EndpointID
[src]
impl<'de> Deserialize<'de> for EndpointID
[src]
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where
D: Deserializer<'de>,
[src]
D: Deserializer<'de>,
impl Display for EndpointID
[src]
impl Eq for EndpointID
[src]
impl Hash for EndpointID
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl PartialEq<EndpointID> for EndpointID
[src]
fn eq(&self, other: &EndpointID) -> bool
[src]
fn ne(&self, other: &EndpointID) -> bool
[src]
impl Serialize for EndpointID
[src]
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
[src]
__S: Serializer,
impl StructuralEq for EndpointID
[src]
impl StructuralPartialEq for EndpointID
[src]
impl<'_> TryFrom<&'_ str> for EndpointID
[src]
type Error = EndpointIdError
The type returned in the event of a conversion error.
fn try_from(item: &str) -> Result<Self, Self::Error>
[src]
impl TryFrom<IpnAddress> for EndpointID
[src]
type Error = EndpointIdError
The type returned in the event of a conversion error.
fn try_from(item: IpnAddress) -> Result<Self, Self::Error>
[src]
impl TryFrom<String> for EndpointID
[src]
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
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,