Trait holochain::prelude::kitsune_p2p::dependencies::kitsune_p2p_types::dht::prelude::Offset
source · pub trait Offset: Sized + Copy + Clone + Deref<Target = u32> + From<u32> {
type Quantum: Quantum;
// Required methods
fn to_absolute(
&self,
topo: &Topology,
power: u8
) -> <Self::Quantum as Quantum>::Absolute;
fn to_quantum(&self, power: u8) -> Self::Quantum;
fn from_absolute_rounded(
loc: DhtLocation,
topo: &Topology,
power: u8
) -> Self;
}
Expand description
An Offset represents the position of the left edge of some Segment. Offsets must be paired with a power to map to quantum coordinates. The absolute DhtLocation of the offset is determined by the “power” of its context, and topology of the space, by:
dht_location = offset * 2^pow * quantum_size
Required Associated Types§
Required Methods§
sourcefn to_absolute(
&self,
topo: &Topology,
power: u8
) -> <Self::Quantum as Quantum>::Absolute
fn to_absolute( &self, topo: &Topology, power: u8 ) -> <Self::Quantum as Quantum>::Absolute
Get the absolute coordinate for this Offset
sourcefn to_quantum(&self, power: u8) -> Self::Quantum
fn to_quantum(&self, power: u8) -> Self::Quantum
Get the quantum coordinate for this Offset
sourcefn from_absolute_rounded(loc: DhtLocation, topo: &Topology, power: u8) -> Self
fn from_absolute_rounded(loc: DhtLocation, topo: &Topology, power: u8) -> Self
Get the nearest rounded-down Offset for the given Loc
Object Safety§
This trait is not object safe.