pub enum DhtArcRange<T = DhtLocation> {
Empty,
Full,
Bounded(T, T),
}
Expand description
A variant of DHT arc which is intentionally forgetful of the Agent’s location. This type is used in places where set logic (union and intersection) is performed on arcs, which splits and joins arcs in such a way that it doesn’t make sense to claim that the arc belongs to any particular agent or location.
This type exists to make sure we don’t accidentally intepret the starting point of such a “derived” arc as a legitimate agent location.
Variants§
Implementations§
§impl<T> DhtArcRange<T>where
T: PartialOrd<T> + Num,
impl<T> DhtArcRange<T>where
T: PartialOrd<T> + Num,
§impl<T> DhtArcRange<T>
impl<T> DhtArcRange<T>
pub fn map<U, F>(self, f: F) -> DhtArcRange<U>where
F: Fn(T) -> U,
§impl<T> DhtArcRange<T>where
T: AsPrimitive<u32>,
impl<T> DhtArcRange<T>where
T: AsPrimitive<u32>,
pub fn from_bounds(start: T, end: T) -> DhtArcRange<DhtLocation>
pub fn from_start_and_len(start: T, len: u64) -> DhtArcRange<DhtLocation>
pub fn from_start_and_half_len(
start: T,
half_len: u32
) -> DhtArcRange<DhtLocation>
pub fn from_start_and_half_len(
start: T,
half_len: u32
) -> DhtArcRange<DhtLocation>
Convenience for our legacy code which defined arcs in terms of half-lengths rather than full lengths
pub fn new_generic(start: T, end: T) -> DhtArcRange<T>
§impl DhtArcRange<u32>
impl DhtArcRange<u32>
pub fn canonical(self) -> DhtArcRange<DhtLocation>
§impl DhtArcRange<DhtLocation>
impl DhtArcRange<DhtLocation>
pub fn new_empty() -> DhtArcRange<DhtLocation>
pub fn new_empty() -> DhtArcRange<DhtLocation>
Constructor
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
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 to_ascii_with_ops<L, I>(&self, len: usize, ops: I) -> Stringwhere
L: Into<Loc8>,
I: IntoIterator<Item = L>,
pub fn to_ascii_with_ops<L, I>(&self, len: usize, ops: I) -> Stringwhere
L: Into<Loc8>,
I: IntoIterator<Item = L>,
Ascii representation of an arc, with a histogram of op locations superimposed. Each character of the string, if an op falls in that “bucket”, will be represented by a hexadecimal digit representing the number of ops in that bucket, with a max of 0xF (15)
pub fn canonical(self) -> DhtArcRange<DhtLocation>
§impl DhtArcRange<DhtLocation>
impl DhtArcRange<DhtLocation>
pub fn as_loc8(&self) -> DhtArcRange<Loc8>
§impl<L> DhtArcRange<L>where
Loc8: From<L>,
impl<L> DhtArcRange<L>where
Loc8: From<L>,
pub fn canonical(self) -> DhtArcRange<DhtLocation>
Trait Implementations§
source§impl AsRef<DhtArcRange<Loc8>> for SwitchboardAgent
impl AsRef<DhtArcRange<Loc8>> for SwitchboardAgent
source§fn as_ref(&self) -> &DhtArcRange<Loc8>
fn as_ref(&self) -> &DhtArcRange<Loc8>
§impl<T> Clone for DhtArcRange<T>where
T: Clone,
impl<T> Clone for DhtArcRange<T>where
T: Clone,
§fn clone(&self) -> DhtArcRange<T>
fn clone(&self) -> DhtArcRange<T>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more§impl<T> Debug for DhtArcRange<T>where
T: Debug,
impl<T> Debug for DhtArcRange<T>where
T: Debug,
§impl<'de, T> Deserialize<'de> for DhtArcRange<T>where
T: Deserialize<'de>,
impl<'de, T> Deserialize<'de> for DhtArcRange<T>where
T: Deserialize<'de>,
§fn deserialize<__D>(
__deserializer: __D
) -> Result<DhtArcRange<T>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D
) -> Result<DhtArcRange<T>, <__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<&DhtArcRange<DhtLocation>> for DhtArcSet
impl From<&DhtArcRange<DhtLocation>> for DhtArcSet
§fn from(arc: &DhtArcRange<DhtLocation>) -> DhtArcSet
fn from(arc: &DhtArcRange<DhtLocation>) -> DhtArcSet
§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<DhtArcRange<DhtLocation>> for DhtArcSet
impl From<DhtArcRange<DhtLocation>> for DhtArcSet
§fn from(arc: DhtArcRange<DhtLocation>) -> DhtArcSet
fn from(arc: DhtArcRange<DhtLocation>) -> DhtArcSet
§impl<T> Hash for DhtArcRange<T>where
T: Hash,
impl<T> Hash for DhtArcRange<T>where
T: Hash,
§impl<T> PartialEq<DhtArcRange<T>> for DhtArcRange<T>where
T: PartialEq<T>,
impl<T> PartialEq<DhtArcRange<T>> for DhtArcRange<T>where
T: PartialEq<T>,
§fn eq(&self, other: &DhtArcRange<T>) -> bool
fn eq(&self, other: &DhtArcRange<T>) -> bool
self
and other
values to be equal, and is used
by ==
.§impl<T> Serialize for DhtArcRange<T>where
T: Serialize,
impl<T> Serialize for DhtArcRange<T>where
T: Serialize,
§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<T> Copy for DhtArcRange<T>where
T: Copy,
impl<T> Eq for DhtArcRange<T>where
T: Eq,
impl<T> StructuralEq for DhtArcRange<T>
impl<T> StructuralPartialEq for DhtArcRange<T>
Auto Trait Implementations§
impl<T> RefUnwindSafe for DhtArcRange<T>where
T: RefUnwindSafe,
impl<T> Send for DhtArcRange<T>where
T: Send,
impl<T> Sync for DhtArcRange<T>where
T: Sync,
impl<T> Unpin for DhtArcRange<T>where
T: Unpin,
impl<T> UnwindSafe for DhtArcRange<T>where
T: UnwindSafe,
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
§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
§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<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.§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>
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.