pub type ArqLocated = Arq<DhtLocation>;
Expand description

Alias for Arq with an Loc start

Aliased Type§

struct ArqLocated {
    pub start: DhtLocation,
    pub power: u8,
    pub count: SpaceOffset,
}

Fields§

§start: DhtLocation

The “start” defines the left edge of the arq

§power: u8

The level of quantization. Total length is 2^power * count. The power must be between 0 and 31, inclusive (power of 32 causes overflow)

§count: SpaceOffset

The number of unit lengths. We never expect the count to be less than 4 or so, and not much larger than 32.

Implementations§

§

impl<S> Arq<S>where S: ArqStart,

pub fn to_ascii(&self, topo: &Topology, 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

§

impl<S> Arq<S>where S: ArqStart,

pub fn new(power: u8, start: S, count: SpaceOffset) -> Arq<S>

Constructor from individual parts

pub fn absolute_length(&self, topo: &Topology) -> u64

The absolute length of the entire arq.

pub fn to_dht_arc_range(&self, topo: &Topology) -> DhtArcRange<DhtLocation>

Convert to DhtArcRange

pub fn to_edge_locs(&self, topo: &Topology) -> (DhtLocation, DhtLocation)

Determine the edges of this Arq in absolute coordinates (Loc)

pub fn power(&self) -> u8

Accessor

pub fn count(&self) -> u32

Accessor

pub fn coverage(&self, topo: &Topology) -> f64

What portion of the whole circle does this arq cover?

pub fn requantize(&self, new_power: u8) -> Option<Arq<S>>

Requantize to a different power. If requantizing to a higher power, only requantize if there is no information loss due to rounding. Otherwise, return None.

pub fn is_full(&self, topo: &Topology) -> bool

This arq has full coverage

pub fn is_empty(&self) -> bool

This arq has zero coverage

§

impl Arq<DhtLocation>

pub fn new_full( topo: &Topology, start: DhtLocation, power: u8 ) -> Arq<DhtLocation>

Construct a full arq at the given power. The count is calculated accordingly.

pub fn downshift(&self) -> Arq<DhtLocation>

Reduce the power by 1

pub fn upshift(&self, force: bool) -> Option<Arq<DhtLocation>>

Increase the power by 1. If this results in rounding, return None, unless force is true, in which case always return Some.

pub fn to_bounds(&self, topo: &Topology) -> Arq<SpaceOffset>

Convert to the ArqBounds representation, which forgets about the Loc associated with this arq.

pub fn start_loc(&self) -> DhtLocation

Get a reference to the arq’s left edge in absolute coordinates.

pub fn count_mut(&mut self) -> &mut u32

Get a mutable reference to the arq’s count.

pub fn to_dht_arc(&self, topo: &Topology) -> DhtArc

Convert to DhtArc

pub fn from_dht_arc_approximate( topo: &Topology, strat: &ArqStrat, dht_arc: &DhtArc ) -> Arq<DhtLocation>

Computes the Arq which most closely matches the given DhtArc

pub fn equivalent( topo: &Topology, a: &Arq<DhtLocation>, b: &Arq<DhtLocation> ) -> bool

The two arqs represent the same interval despite having potentially different terms

Trait Implementations§

§

impl<S> Clone for Arq<S>where S: Clone + ArqStart,

§

fn clone(&self) -> Arq<S>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl<S> Debug for Arq<S>where S: Debug + ArqStart,

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
§

impl<'de, S> Deserialize<'de> for Arq<S>where S: ArqStart + Deserialize<'de>,

§

fn deserialize<__D>( __deserializer: __D ) -> Result<Arq<S>, <__D as Deserializer<'de>>::Error>where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
§

impl<S> PartialEq<Arq<S>> for Arq<S>where S: PartialEq<S> + ArqStart,

§

fn eq(&self, other: &Arq<S>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

impl<S> Serialize for Arq<S>where S: ArqStart + Serialize,

§

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<S> Copy for Arq<S>where S: Copy + ArqStart,

§

impl<S> Eq for Arq<S>where S: Eq + ArqStart,

§

impl<S> StructuralEq for Arq<S>where S: ArqStart,

§

impl<S> StructuralPartialEq for Arq<S>where S: ArqStart,