pub type ArqBounds = Arq<SpaceOffset>;
Expand description

Alias for Arq with an SpaceOffset start

Aliased Type§

struct ArqBounds {
    pub start: SpaceOffset,
    pub power: u8,
    pub count: SpaceOffset,
}

Fields§

§start: SpaceOffset

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<SpaceOffset>

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

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

pub fn from_interval_rounded( topo: &Topology, power: u8, interval: DhtArcRange<DhtLocation> ) -> (Arq<SpaceOffset>, bool)

Return the ArqBounds which most closely matches the given DhtArcRange

pub fn from_interval( topo: &Topology, power: u8, interval: DhtArcRange<DhtLocation> ) -> Option<Arq<SpaceOffset>>

Return the ArqBounds which is equivalent to the given DhtArcRange if it exists.

pub fn to_arq<F>(&self, topo: &Topology, f: F) -> Arq<DhtLocation>where F: FnOnce(DhtLocation) -> DhtLocation,

Upcast this ArqBounds to an Arq that has knowledge of its Loc

pub fn empty(topo: &Topology, power: u8) -> Arq<SpaceOffset>

An arbitrary zero-coverage arq.

pub fn segments(&self) -> impl Iterator<Item = Segment<SpaceOffset>>

Iterate over each segment (chunk) in the Arq

pub fn offset(&self) -> SpaceOffset

Get a reference to the arq bounds’s offset.

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 From<&Arq<SpaceOffset>> for Arq<SpaceOffset>

§

fn from(a: &Arq<SpaceOffset>) -> Arq<SpaceOffset>

Converts to this type from the input type.
§

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,