pub struct Range3d<const MCL: usize, const MCC: usize, const MPL: usize, S> { /* private fields */ }Expand description
An arbitrary box in three-dimensional willow space, consisting of a SubspaceRange, a PathRange, and a TimeRange.
As an application developer, you probably do not need to interact with 3d ranges, you should prefer Areas — the latter work well with encrypted data, whereas 3d ranges do not define human-meaningful subsets of data when working with encryption.
use willow_data_model::prelude::*;
let r = Range3d::<2, 2, 2, u8>::new(5..=8, .., ..Timestamp::from(17));
assert!(r.wdm_includes(&(6, Path::new(), Timestamp::from(9))));
assert_eq!(r.subspaces(), &WillowRange::from(5u8..9));
let r2 = Range3d::<2, 2, 2, u8>::new(7..8, .., Timestamp::from(15)..);
assert_eq!(
r.wdm_intersection(&r2),
Range3d::<2, 2, 2, u8>::new(7..8, .., Timestamp::from(15)..Timestamp::from(17)),
);Implementations§
Source§impl<const MCL: usize, const MCC: usize, const MPL: usize, S> Range3d<MCL, MCC, MPL, S>
impl<const MCL: usize, const MCC: usize, const MPL: usize, S> Range3d<MCL, MCC, MPL, S>
Sourcepub fn new<SR, PR, TR>(subspaces: SR, paths: PR, times: TR) -> Self
pub fn new<SR, PR, TR>(subspaces: SR, paths: PR, times: TR) -> Self
Creates a new Range3d from its constituent SubspaceRange, PathRange, and TimeRange.
use willow_data_model::prelude::*;
let r = Range3d::<2, 2, 2, u8>::new(5..=8, .., ..Timestamp::from(17));
assert!(r.wdm_includes(&(6, Path::new(), Timestamp::from(9))));
assert_eq!(r.subspaces(), &WillowRange::from(5u8..9));Sourcepub fn subspaces(&self) -> &SubspaceRange<S>
pub fn subspaces(&self) -> &SubspaceRange<S>
Returns a reference to the inner SubspaceRange.
use willow_data_model::prelude::*;
let r = Range3d::<2, 2, 2, u8>::new(5..=8, .., ..Timestamp::from(17));
assert_eq!(r.subspaces(), &SubspaceRange::from(5u8..9));Sourcepub fn paths(&self) -> &PathRange<MCL, MCC, MPL>
pub fn paths(&self) -> &PathRange<MCL, MCC, MPL>
Returns a reference to the inner PathRange.
use willow_data_model::prelude::*;
let r = Range3d::<2, 2, 2, u8>::new(5..=8, .., ..Timestamp::from(17));
assert_eq!(r.paths(), &WillowRange::full());Sourcepub fn times(&self) -> &TimeRange
pub fn times(&self) -> &TimeRange
Returns a reference to the inner TimeRange.
use willow_data_model::prelude::*;
let r = Range3d::<2, 2, 2, u8>::new(5..=8, .., ..Timestamp::from(17));
assert_eq!(r.times(), &WillowRange::from(..Timestamp::from(17)));Sourcepub fn set_subspaces<SR>(&mut self, new_range: SR)where
SR: Into<SubspaceRange<S>>,
pub fn set_subspaces<SR>(&mut self, new_range: SR)where
SR: Into<SubspaceRange<S>>,
Sets the inner SubspaceRange.
Source§impl<const MCL: usize, const MCC: usize, const MPL: usize, S> Range3d<MCL, MCC, MPL, S>where
S: Clone + SuccessorExceptForGreatest,
impl<const MCL: usize, const MCC: usize, const MPL: usize, S> Range3d<MCL, MCC, MPL, S>where
S: Clone + SuccessorExceptForGreatest,
Sourcepub fn singleton<Coord>(coord: &Coord) -> Selfwhere
Coord: Coordinatelike<MCL, MCC, MPL, S>,
pub fn singleton<Coord>(coord: &Coord) -> Selfwhere
Coord: Coordinatelike<MCL, MCC, MPL, S>,
Returns the Range3d which includes coord but no other value.
use willow_data_model::prelude::*;
let r = Range3d::<2, 2, 2, u8>::singleton(&(6, Path::new(), Timestamp::from(9)));
assert!(r.wdm_includes(&(6, Path::new(), Timestamp::from(9))));
assert!(!r.wdm_includes(&(16, Path::new(), Timestamp::from(9))));Source§impl<const MCL: usize, const MCC: usize, const MPL: usize, S> Range3d<MCL, MCC, MPL, S>
impl<const MCL: usize, const MCC: usize, const MPL: usize, S> Range3d<MCL, MCC, MPL, S>
Sourcepub fn full() -> Self
pub fn full() -> Self
Returns the Range3d which includes every coordinate.
use willow_data_model::prelude::*;
let r = Range3d::<2, 2, 2, u8>::full();
assert!(r.wdm_includes(&(6, Path::new(), Timestamp::from(9))));
assert!(r.wdm_includes(&(16, Path::new(), Timestamp::from(9))));Sourcepub fn is_full(&self) -> bool
pub fn is_full(&self) -> bool
Returns whether self is the full 3d range, i.e., the 3d range which includes every coordinate.
use willow_data_model::prelude::*;
assert!(Range3d::<2, 2, 2, u8>::full().is_full());
assert!(!Range3d::<2, 2, 2, u8>::new(5..=8, .., ..Timestamp::from(17)).is_full());Trait Implementations§
Source§impl<'arbitrary, const MCL: usize, const MCC: usize, const MPL: usize, S: Arbitrary<'arbitrary>> Arbitrary<'arbitrary> for Range3d<MCL, MCC, MPL, S>
impl<'arbitrary, const MCL: usize, const MCC: usize, const MPL: usize, S: Arbitrary<'arbitrary>> Arbitrary<'arbitrary> for Range3d<MCL, MCC, MPL, S>
Source§fn arbitrary(u: &mut Unstructured<'arbitrary>) -> Result<Self>
fn arbitrary(u: &mut Unstructured<'arbitrary>) -> Result<Self>
Self from the given unstructured data. Read moreSource§fn arbitrary_take_rest(u: Unstructured<'arbitrary>) -> Result<Self>
fn arbitrary_take_rest(u: Unstructured<'arbitrary>) -> Result<Self>
Self from the entirety of the given
unstructured data. Read moreSource§fn size_hint(depth: usize) -> (usize, Option<usize>)
fn size_hint(depth: usize) -> (usize, Option<usize>)
Unstructured this type
needs to construct itself. Read moreSource§fn try_size_hint(
depth: usize,
) -> Result<(usize, Option<usize>), MaxRecursionReached>
fn try_size_hint( depth: usize, ) -> Result<(usize, Option<usize>), MaxRecursionReached>
Unstructured this type
needs to construct itself. Read moreSource§impl<const MCL: usize, const MCC: usize, const MPL: usize, S: Clone> Clone for Range3d<MCL, MCC, MPL, S>
impl<const MCL: usize, const MCC: usize, const MPL: usize, S: Clone> Clone for Range3d<MCL, MCC, MPL, S>
Source§impl<const MCL: usize, const MCC: usize, const MPL: usize, S: Debug> Debug for Range3d<MCL, MCC, MPL, S>
impl<const MCL: usize, const MCC: usize, const MPL: usize, S: Debug> Debug for Range3d<MCL, MCC, MPL, S>
Source§impl<const MCL: usize, const MCC: usize, const MPL: usize, S> From<Area<MCL, MCC, MPL, S>> for Range3d<MCL, MCC, MPL, S>
impl<const MCL: usize, const MCC: usize, const MPL: usize, S> From<Area<MCL, MCC, MPL, S>> for Range3d<MCL, MCC, MPL, S>
Source§impl<const MCL: usize, const MCC: usize, const MPL: usize, S> GreatestElement for Range3d<MCL, MCC, MPL, S>
impl<const MCL: usize, const MCC: usize, const MPL: usize, S> GreatestElement for Range3d<MCL, MCC, MPL, S>
Source§impl<const MCL: usize, const MCC: usize, const MPL: usize, S> Grouping<MCL, MCC, MPL, S> for Range3d<MCL, MCC, MPL, S>
impl<const MCL: usize, const MCC: usize, const MPL: usize, S> Grouping<MCL, MCC, MPL, S> for Range3d<MCL, MCC, MPL, S>
Source§fn wdm_includes<Coord>(&self, coord: &Coord) -> boolwhere
Coord: Coordinatelike<MCL, MCC, MPL, S> + ?Sized,
fn wdm_includes<Coord>(&self, coord: &Coord) -> boolwhere
Coord: Coordinatelike<MCL, MCC, MPL, S> + ?Sized,
true iff the given Coordinatelike value is included in this grouping.Source§fn wdm_includes_grouping(&self, other: &Self) -> bool
fn wdm_includes_grouping(&self, other: &Self) -> bool
Source§fn wdm_strictly_includes_grouping(&self, other: &Self) -> bool
fn wdm_strictly_includes_grouping(&self, other: &Self) -> bool
Source§fn wdm_includes_in_intersection<Coord>(
&self,
other: &Self,
coord: &Coord,
) -> boolwhere
Coord: Coordinatelike<MCL, MCC, MPL, S> + ?Sized,
fn wdm_includes_in_intersection<Coord>(
&self,
other: &Self,
coord: &Coord,
) -> boolwhere
Coord: Coordinatelike<MCL, MCC, MPL, S> + ?Sized,
Source§fn wdm_is_empty(&self) -> bool
fn wdm_is_empty(&self) -> bool
Source§fn wdm_intersection(&self, other: &Self) -> Self
fn wdm_intersection(&self, other: &Self) -> Self
Source§impl<const MCL: usize, const MCC: usize, const MPL: usize, S> Hash for Range3d<MCL, MCC, MPL, S>
impl<const MCL: usize, const MCC: usize, const MPL: usize, S> Hash for Range3d<MCL, MCC, MPL, S>
Source§impl<const MCL: usize, const MCC: usize, const MPL: usize, S> LeastElement for Range3d<MCL, MCC, MPL, S>
impl<const MCL: usize, const MCC: usize, const MPL: usize, S> LeastElement for Range3d<MCL, MCC, MPL, S>
Source§impl<const MCL: usize, const MCC: usize, const MPL: usize, S> LowerSemilattice for Range3d<MCL, MCC, MPL, S>
impl<const MCL: usize, const MCC: usize, const MPL: usize, S> LowerSemilattice for Range3d<MCL, MCC, MPL, S>
Source§fn greatest_lower_bound(&self, other: &Self) -> Self
fn greatest_lower_bound(&self, other: &Self) -> Self
self and other, i.e., the unique greatest element in the type which is less than or equal to both self and other.Source§impl<const MCL: usize, const MCC: usize, const MPL: usize, S> PartialEq for Range3d<MCL, MCC, MPL, S>
A 3d-range is equal to another iff both include exactly the same values.
impl<const MCL: usize, const MCC: usize, const MPL: usize, S> PartialEq for Range3d<MCL, MCC, MPL, S>
A 3d-range is equal to another iff both include exactly the same values.
Source§impl<const MCL: usize, const MCC: usize, const MPL: usize, S> PartialOrd for Range3d<MCL, MCC, MPL, S>
A 3d-range is less than another iff all values included in the first are also included in the other.
impl<const MCL: usize, const MCC: usize, const MPL: usize, S> PartialOrd for Range3d<MCL, MCC, MPL, S>
A 3d-range is less than another iff all values included in the first are also included in the other.
Source§fn partial_cmp(&self, other: &Self) -> Option<Ordering>
fn partial_cmp(&self, other: &Self) -> Option<Ordering>
A 3d-range is less than another iff all values included in the first are also included in the other.
Source§impl<const MCL: usize, const MCC: usize, const MPL: usize, S> UpperSemilattice for Range3d<MCL, MCC, MPL, S>
impl<const MCL: usize, const MCC: usize, const MPL: usize, S> UpperSemilattice for Range3d<MCL, MCC, MPL, S>
Source§fn least_upper_bound(&self, other: &Self) -> Self
fn least_upper_bound(&self, other: &Self) -> Self
self and other, i.e., the unique least element in the type which is greater than or equal to both self and other.