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 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
Trait Implementations§
§impl Deref for DhtArc
impl Deref for DhtArc
§type Target = DhtArcRange<DhtLocation>
type Target = DhtArcRange<DhtLocation>
The resulting type after dereferencing.
§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>,
Deserialize this value from the given Serde deserializer. Read more
§impl From<&DhtArc> for DhtArcRange<DhtLocation>
impl From<&DhtArc> for DhtArcRange<DhtLocation>
§fn from(a: &DhtArc) -> DhtArcRange<DhtLocation>
fn from(a: &DhtArc) -> DhtArcRange<DhtLocation>
Converts to this type from the input type.
§impl From<DhtArc> for DhtArcRange<DhtLocation>
impl From<DhtArc> for DhtArcRange<DhtLocation>
§fn from(a: DhtArc) -> DhtArcRange<DhtLocation>
fn from(a: DhtArc) -> DhtArcRange<DhtLocation>
Converts to this type from the input type.
§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,
Serialize this value into the given Serde serializer. Read more
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> Any for Twhere
T: Any + ?Sized,
impl<T> Any for Twhere T: Any + ?Sized,
§fn type_id_compat(&self) -> TypeId
fn type_id_compat(&self) -> TypeId
TODO: once 1.33.0 is the minimum supported compiler version, remove
Any::type_id_compat and use StdAny::type_id instead.
https://github.com/rust-lang/rust/issues/27745
§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata ) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
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
Mutably borrows from an owned value. Read more
§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>
Deserializes using the given deserializer
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<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> ⓘ
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>
The inverse inclusion map: attempts to construct
self
from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
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
Use with care! Same as
self.to_subset
but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self
to the equivalent element of its superset.§impl<T> Upcastable for Twhere
T: Any + Send + Sync + 'static,
impl<T> Upcastable for Twhere T: Any + Send + Sync + 'static,
§fn upcast_any_ref(&self) -> &(dyn Any + 'static)
fn upcast_any_ref(&self) -> &(dyn Any + 'static)
upcast ref
§fn upcast_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn upcast_any_mut(&mut self) -> &mut (dyn Any + 'static)
upcast mut ref