Struct holochain::prelude::kitsune_p2p::dependencies::kitsune_p2p_types::dht_arc::DhtArc
pub struct DhtArc(_, _);
Expand description
The main DHT arc type. Represents an Agent’s storage Arc on the DHT,
preserving the agent’s DhtLocation even in the case of a Full or Empty arc.
Contrast to DhtArcRange
, which is used for cases where the arc is not
associated with any particular Agent, and so the agent’s Location cannot be known.
Implementations§
§impl DhtArc
impl DhtArc
pub fn bounded(a: DhtArcRange<DhtLocation>) -> DhtArc
pub fn empty(loc: DhtLocation) -> DhtArc
pub fn full(loc: DhtLocation) -> DhtArc
pub fn start_loc(&self) -> DhtLocation
pub fn inner(self) -> DhtArcRange<DhtLocation>
pub fn from_parts(a: DhtArcRange<DhtLocation>, loc: DhtLocation) -> DhtArc
pub fn from_parts(a: DhtArcRange<DhtLocation>, loc: DhtLocation) -> DhtArc
Construct from an arc range and a location. The location is only used if the arc range is full or empty.
pub fn from_start_and_half_len<L>(start: L, half_len: u32) -> DhtArcwhere L: Into<DhtLocation>,
pub fn from_start_and_len<L>(start: L, len: u64) -> DhtArcwhere L: Into<DhtLocation>,
pub fn from_bounds<L>(start: L, end: L) -> DhtArcwhere L: Into<DhtLocation>,
pub fn update_length(&mut self, new_length: u64)
pub fn to_ascii(&self, len: usize) -> String
Methods from Deref<Target = DhtArcRange<DhtLocation>>§
pub fn contains<B>(&self, t: B) -> boolwhere B: Borrow<T>,
pub fn to_bounds_grouped(&self) -> Option<(DhtLocation, DhtLocation)>
pub fn to_bounds_grouped(&self) -> Option<(DhtLocation, DhtLocation)>
Represent an arc as an optional range of inclusive endpoints. If none, the arc length is 0
pub fn to_primitive_bounds_detached(&self) -> (Option<u32>, Option<u32>)
pub fn to_primitive_bounds_detached(&self) -> (Option<u32>, Option<u32>)
Same as to_bounds_grouped, but with the return type “inside-out”
pub fn is_bounded(&self) -> bool
pub fn is_bounded(&self) -> bool
Check if this arc is bounded.
pub fn dist(&self, tgt: u32) -> u32
pub fn dist(&self, tgt: u32) -> u32
Get the min distance to a location. Zero if Full, u32::MAX if Empty.
pub fn overlaps(&self, other: &DhtArcRange<DhtLocation>) -> bool
pub fn overlaps(&self, other: &DhtArcRange<DhtLocation>) -> bool
Check if arcs overlap
pub fn overlap_coverage(&self, other: &DhtArcRange<DhtLocation>) -> f64
pub fn overlap_coverage(&self, other: &DhtArcRange<DhtLocation>) -> f64
Amount of intersection between two arcs
pub fn length(&self) -> u64
pub fn half_length(&self) -> u32
pub fn to_ascii(&self, len: usize) -> String
pub fn to_ascii(&self, len: usize) -> String
Handy ascii representation of an arc, especially useful when looking at several arcs at once to get a sense of their overlap
pub fn print(&self, len: usize)
Trait Implementations§
§impl Deref for DhtArc
impl Deref for DhtArc
§type Target = DhtArcRange<DhtLocation>
type Target = DhtArcRange<DhtLocation>
§impl<'de> Deserialize<'de> for DhtArc
impl<'de> Deserialize<'de> for DhtArc
§fn deserialize<__D>(
__deserializer: __D
) -> Result<DhtArc, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>( __deserializer: __D ) -> Result<DhtArc, <__D as Deserializer<'de>>::Error>where __D: Deserializer<'de>,
§impl From<&DhtArc> for DhtArcRange<DhtLocation>
impl From<&DhtArc> for DhtArcRange<DhtLocation>
§fn from(a: &DhtArc) -> DhtArcRange<DhtLocation>
fn from(a: &DhtArc) -> DhtArcRange<DhtLocation>
§impl From<DhtArc> for DhtArcRange<DhtLocation>
impl From<DhtArc> for DhtArcRange<DhtLocation>
§fn from(a: DhtArc) -> DhtArcRange<DhtLocation>
fn from(a: DhtArc) -> DhtArcRange<DhtLocation>
§impl Serialize for DhtArc
impl Serialize for DhtArc
§fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>( &self, __serializer: __S ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where __S: Serializer,
impl Copy for DhtArc
Auto Trait Implementations§
impl RefUnwindSafe for DhtArc
impl Send for DhtArc
impl Sync for DhtArc
impl Unpin for DhtArc
impl UnwindSafe for DhtArc
Blanket Implementations§
§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
§type ArchivedMetadata = ()
type ArchivedMetadata = ()
§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata ) -> <T as Pointee>::Metadata
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
§impl<F, W, T, D> Deserialize<With<T, W>, D> for Fwhere
W: DeserializeWith<F, T, D>,
D: Fallible + ?Sized,
F: ?Sized,
impl<F, W, T, D> Deserialize<With<T, W>, D> for Fwhere W: DeserializeWith<F, T, D>, D: Fallible + ?Sized, F: ?Sized,
§fn deserialize(
&self,
deserializer: &mut D
) -> Result<With<T, W>, <D as Fallible>::Error>
fn deserialize( &self, deserializer: &mut D ) -> Result<With<T, W>, <D as Fallible>::Error>
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self
is actually part of its subset T
(and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.