Type Alias kitsune_p2p_dht::arq::ArqBounds

source ·
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§

source§

impl ArqBounds

source

pub fn equivalent(dim: impl SpaceDim, a: &Self, b: &Self) -> bool

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

source

pub fn from_interval_rounded( dim: impl SpaceDim, power: u8, interval: DhtArcRange, ) -> (Self, bool)

Return the ArqBounds which most closely matches the given DhtArcRange

source

pub fn from_interval( dim: impl SpaceDim, power: u8, interval: DhtArcRange, ) -> Option<Self>

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

source

pub fn empty(dim: impl SpaceDim, power: u8) -> Self

An arbitrary zero-coverage arq.

source

pub fn segments(&self) -> impl Iterator<Item = SpaceSegment> + '_

Iterate over each segment (chunk) in the Arq

source

pub fn offset(&self) -> SpaceOffset

Get a reference to the arq bounds’s offset.

Trait Implementations§

source§

impl From<&Arq<SpaceOffset>> for ArqBounds

source§

fn from(a: &ArqBounds) -> Self

Converts to this type from the input type.