Struct kitsune_p2p_dht::region_set::RegionSetLtcs
source · pub struct RegionSetLtcs<D: RegionDataConstraints = RegionData> {
pub coords: RegionCoordSetLtcs,
/* private fields */
}
Expand description
Implementation for the compact LTCS region set format which gets sent over the wire. The coordinates for the regions are specified by a few values. The data to match the coordinates are specified in a 2D vector which must correspond to the generated coordinates.
Fields§
§coords: RegionCoordSetLtcs
The generator for the coordinates
Implementations§
source§impl<D: RegionDataConstraints> RegionSetLtcs<D>
impl<D: RegionDataConstraints> RegionSetLtcs<D>
sourcepub fn from_data(coords: RegionCoordSetLtcs, data: Vec<Vec<Vec<D>>>) -> Self
pub fn from_data(coords: RegionCoordSetLtcs, data: Vec<Vec<Vec<D>>>) -> Self
Construct the region set from existing data. The data must match the coords!
sourcepub fn regions(&self) -> impl Iterator<Item = Region<D>> + '_
pub fn regions(&self) -> impl Iterator<Item = Region<D>> + '_
Iterate over each region in the set
sourcepub fn rectify(&mut self, other: &mut Self) -> GossipResult<()>
pub fn rectify(&mut self, other: &mut Self) -> GossipResult<()>
Reshape the two region sets so that both match, omitting or merging regions as needed
sourcepub fn diff(self, other: Self) -> GossipResult<Vec<Region<D>>>
pub fn diff(self, other: Self) -> GossipResult<Vec<Region<D>>>
Given two region sets, return only the ones which are different between the two
sourcepub fn nonzero_regions(
&self
) -> impl '_ + Iterator<Item = ((usize, usize, usize), RegionCoords, D)>
pub fn nonzero_regions( &self ) -> impl '_ + Iterator<Item = ((usize, usize, usize), RegionCoords, D)>
Return only the regions which have ops in them. Useful for testing sparse scenarios.
source§impl<D: RegionDataConstraints> RegionSetLtcs<D>
impl<D: RegionDataConstraints> RegionSetLtcs<D>
sourcepub fn from_store<O: OpRegion<D>, S: AccessOpStore<O, D>>(
store: &S,
coords: RegionCoordSetLtcs
) -> Self
pub fn from_store<O: OpRegion<D>, S: AccessOpStore<O, D>>( store: &S, coords: RegionCoordSetLtcs ) -> Self
Query the specified OpStore for each coord in the set, constructing the full RegionSet. Purely for convenience.
Trait Implementations§
source§impl<D: Clone + RegionDataConstraints> Clone for RegionSetLtcs<D>
impl<D: Clone + RegionDataConstraints> Clone for RegionSetLtcs<D>
source§fn clone(&self) -> RegionSetLtcs<D>
fn clone(&self) -> RegionSetLtcs<D>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl<D: RegionDataConstraints> Debug for RegionSetLtcs<D>
impl<D: RegionDataConstraints> Debug for RegionSetLtcs<D>
source§impl<'de, D> Deserialize<'de> for RegionSetLtcs<D>where
D: DeserializeOwned + RegionDataConstraints,
impl<'de, D> Deserialize<'de> for RegionSetLtcs<D>where
D: DeserializeOwned + RegionDataConstraints,
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
source§impl<T: RegionDataConstraints> From<RegionSetLtcs<T>> for RegionSet<T>
impl<T: RegionDataConstraints> From<RegionSetLtcs<T>> for RegionSet<T>
source§fn from(original: RegionSetLtcs<T>) -> RegionSet<T>
fn from(original: RegionSetLtcs<T>) -> RegionSet<T>
source§impl<D> PartialEq for RegionSetLtcs<D>where
D: PartialEq + RegionDataConstraints,
impl<D> PartialEq for RegionSetLtcs<D>where
D: PartialEq + RegionDataConstraints,
source§impl<D> Serialize for RegionSetLtcs<D>where
D: Serialize + RegionDataConstraints,
impl<D> Serialize for RegionSetLtcs<D>where
D: Serialize + RegionDataConstraints,
impl<D> Eq for RegionSetLtcs<D>where
D: Eq + RegionDataConstraints,
Auto Trait Implementations§
impl<D = RegionData> !Freeze for RegionSetLtcs<D>
impl<D> RefUnwindSafe for RegionSetLtcs<D>where
D: DeserializeOwned + for<'de> Deserialize<'de> + Serialize + Debug + Sync + Send + Clone + Sub<Output = D> + AddAssign + Zero<Output = D> + Add + Eq + PartialEq + RefUnwindSafe,
impl<D> Send for RegionSetLtcs<D>
impl<D> Sync for RegionSetLtcs<D>
impl<D> Unpin for RegionSetLtcs<D>
impl<D> UnwindSafe for RegionSetLtcs<D>where
D: DeserializeOwned + for<'de> Deserialize<'de> + Serialize + Debug + Sync + Send + Clone + Sub<Output = D> + AddAssign + Zero<Output = D> + Add + Eq + PartialEq + UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
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<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read moresource§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).source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.