pub struct Item { /* private fields */ }Expand description
Address lookup results from AddressLookups.
This is the item in the streams returned from AddressLookup::resolve.
It contains the EndpointData about the resolved endpoint addresses,
and some additional metadata about the address lookup system.
This struct derefs to EndpointData, so you can access the methods from EndpointData
directly from Item.
Implementations§
Source§impl Item
impl Item
Sourcepub fn new(
endpoint_info: EndpointInfo,
provenance: &'static str,
last_updated: Option<u64>,
) -> Self
pub fn new( endpoint_info: EndpointInfo, provenance: &'static str, last_updated: Option<u64>, ) -> Self
Creates a new Item from a EndpointInfo.
Sourcepub fn endpoint_id(&self) -> EndpointId
pub fn endpoint_id(&self) -> EndpointId
Returns the endpoint id of the discovered endpoint.
Sourcepub fn endpoint_info(&self) -> &EndpointInfo
pub fn endpoint_info(&self) -> &EndpointInfo
Returns the EndpointInfo for the discovered endpoint.
Sourcepub fn provenance(&self) -> &'static str
pub fn provenance(&self) -> &'static str
Returns the provenance of this Address Lookup item.
The provenance is a static string which identifies the Address Lookup service that produced this item.
Sourcepub fn last_updated(&self) -> Option<u64>
pub fn last_updated(&self) -> Option<u64>
Returns the optional timestamp when this endpoint info was last updated.
The value is microseconds since the unix epoch.
Sourcepub fn to_endpoint_addr(&self) -> EndpointAddr
pub fn to_endpoint_addr(&self) -> EndpointAddr
Returns an EndpointAddr by cloning the needed fields.
Sourcepub fn into_endpoint_addr(self) -> EndpointAddr
pub fn into_endpoint_addr(self) -> EndpointAddr
Converts into an EndpointAddr without cloning.
Methods from Deref<Target = EndpointData>§
Sourcepub fn relay_urls(&self) -> impl Iterator<Item = &RelayUrl>
pub fn relay_urls(&self) -> impl Iterator<Item = &RelayUrl>
Returns the relay URL of the endpoint.
Sourcepub fn user_data(&self) -> Option<&UserData>
pub fn user_data(&self) -> Option<&UserData>
Returns the optional user-defined data of the endpoint.
Sourcepub fn ip_addrs(&self) -> impl Iterator<Item = &SocketAddr>
pub fn ip_addrs(&self) -> impl Iterator<Item = &SocketAddr>
Returns the direct addresses of the endpoint.
Sourcepub fn addrs(&self) -> impl Iterator<Item = &TransportAddr>
pub fn addrs(&self) -> impl Iterator<Item = &TransportAddr>
Returns the full list of all known addresses.
Sourcepub fn filtered_addrs(&self, filter: &AddrFilter) -> Cow<'_, Vec<TransportAddr>>
pub fn filtered_addrs(&self, filter: &AddrFilter) -> Cow<'_, Vec<TransportAddr>>
Apply the given filter to the current addresses.
Returns a vec to allow re-ordering of addresses.
Sourcepub fn apply_filter(&self, filter: &AddrFilter) -> Cow<'_, EndpointData>
pub fn apply_filter(&self, filter: &AddrFilter) -> Cow<'_, EndpointData>
Returns the EndpointData with given filter applied.
Trait Implementations§
Source§impl From<Item> for EndpointInfo
impl From<Item> for EndpointInfo
impl Eq for Item
impl StructuralPartialEq for Item
Auto Trait Implementations§
impl Freeze for Item
impl RefUnwindSafe for Item
impl Send for Item
impl Sync for Item
impl Unpin for Item
impl UnwindSafe for Item
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more