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::<4, 4, 4, TestSubspace>::new(
SubspaceRange::new_open(Betty),
PathRange::full(),
TimeRange::new_closed(0.into(), 17.into())
);
assert!(r.wdm_includes(&(Gemma, Path::new(), Timestamp::from(9))));
assert_eq!(r.subspaces(), &SubspaceRange::new_open(Betty));
let r2 = Range3d::<4, 4, 4, TestSubspace>::new(
SubspaceRange::new_closed(Alfie, Dalton),
PathRange::full(),
TimeRange::new_open(15.into()),
);
assert_eq!(
r.wdm_intersection(&r2),
Ok(Range3d::<4, 4, 4, TestSubspace>::new(
SubspaceRange::new_closed(Betty, Dalton),
PathRange::full(),
TimeRange::new_closed(15.into(), 17.into()),
)),
);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::<4, 4, 4, TestSubspace>::new(
SubspaceRange::new_open(Betty),
PathRange::full(),
TimeRange::new_closed(0.into(), 17.into())
);
assert!(r.wdm_includes(&(Gemma, Path::new(), Timestamp::from(9))));
assert_eq!(r.subspaces(), &SubspaceRange::new_open(Betty));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::<4, 4, 4, TestSubspace>::new(
SubspaceRange::new_open(Betty),
PathRange::full(),
TimeRange::new_closed(0.into(), 17.into())
);
assert_eq!(r.subspaces(), &SubspaceRange::new_open(Betty));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::<4, 4, 4, TestSubspace>::new(
SubspaceRange::new_open(Betty),
PathRange::full(),
TimeRange::new_closed(0.into(), 17.into())
);
assert_eq!(r.paths(), &PathRange::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::<4, 4, 4, TestSubspace>::new(
SubspaceRange::new_open(Betty),
PathRange::full(),
TimeRange::new_closed(0.into(), 17.into())
);
assert_eq!(r.times(), &TimeRange::new_closed(0.into(), 17.into()));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::<4, 4, 4, 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>where
S: LeastElement,
impl<const MCL: usize, const MCC: usize, const MPL: usize, S> Range3d<MCL, MCC, MPL, S>where
S: LeastElement,
Sourcepub fn full() -> Self
pub fn full() -> Self
Returns the Range3d which includes every coordinate.
use willow_data_model::prelude::*;
let r = Range3d::<4, 4, 4, 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::<4, 4, 4, TestSubspace>::full().is_full());
assert!(!Range3d::<4, 4, 4, TestSubspace>::new(
SubspaceRange::new_open(Betty),
PathRange::full(),
TimeRange::new_closed(0.into(), 17.into()),
).is_full());Trait Implementations§
Source§impl<'a, const MCL: usize, const MCC: usize, const MPL: usize, S> Arbitrary<'a> for Range3d<MCL, MCC, MPL, S>where
S: PartialOrd + Arbitrary<'a>,
Available on crate feature dev only.
impl<'a, const MCL: usize, const MCC: usize, const MPL: usize, S> Arbitrary<'a> for Range3d<MCL, MCC, MPL, S>where
S: PartialOrd + Arbitrary<'a>,
dev only.Source§fn arbitrary(u: &mut Unstructured<'a>) -> Result<Self>
fn arbitrary(u: &mut Unstructured<'a>) -> Result<Self>
Self from the given unstructured data. 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§fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>
fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>
Self from the entirety of the given
unstructured data. 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>where
S: LeastElement,
impl<const MCL: usize, const MCC: usize, const MPL: usize, S> GreatestElement for Range3d<MCL, MCC, MPL, S>where
S: LeastElement,
Source§impl<const MCL: usize, const MCC: usize, const MPL: usize, S> Grouping<MCL, MCC, MPL, S> for Range3d<MCL, MCC, MPL, S>where
S: PartialOrd,
impl<const MCL: usize, const MCC: usize, const MPL: usize, S> Grouping<MCL, MCC, MPL, S> for Range3d<MCL, MCC, MPL, S>where
S: PartialOrd,
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_intersection(&self, other: &Self) -> Result<Self, EmptyGrouping>where
S: Clone,
fn wdm_intersection(&self, other: &Self) -> Result<Self, EmptyGrouping>where
S: Clone,
self and other. If that set would be empty, returns an EmptyGrouping error instead.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§impl<const MCL: usize, const MCC: usize, const MPL: usize, S: Hash> Hash for Range3d<MCL, MCC, MPL, S>
impl<const MCL: usize, const MCC: usize, const MPL: usize, S: Hash> Hash for Range3d<MCL, MCC, MPL, S>
Source§impl<const MCL: usize, const MCC: usize, const MPL: usize, S: PartialEq> PartialEq for Range3d<MCL, MCC, MPL, S>
impl<const MCL: usize, const MCC: usize, const MPL: usize, S: PartialEq> PartialEq for Range3d<MCL, MCC, MPL, S>
Source§impl<const MCL: usize, const MCC: usize, const MPL: usize, S> PartialOrd for Range3d<MCL, MCC, MPL, S>where
S: PartialOrd,
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>where
S: PartialOrd,
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.
impl<const MCL: usize, const MCC: usize, const MPL: usize, S: Eq> Eq for Range3d<MCL, MCC, MPL, S>
impl<const MCL: usize, const MCC: usize, const MPL: usize, S> StructuralPartialEq for Range3d<MCL, MCC, MPL, S>
Auto Trait Implementations§
impl<const MCL: usize, const MCC: usize, const MPL: usize, S> !Freeze for Range3d<MCL, MCC, MPL, S>
impl<const MCL: usize, const MCC: usize, const MPL: usize, S> RefUnwindSafe for Range3d<MCL, MCC, MPL, S>where
S: RefUnwindSafe,
impl<const MCL: usize, const MCC: usize, const MPL: usize, S> Send for Range3d<MCL, MCC, MPL, S>where
S: Send,
impl<const MCL: usize, const MCC: usize, const MPL: usize, S> Sync for Range3d<MCL, MCC, MPL, S>where
S: Sync,
impl<const MCL: usize, const MCC: usize, const MPL: usize, S> Unpin for Range3d<MCL, MCC, MPL, S>where
S: Unpin,
impl<const MCL: usize, const MCC: usize, const MPL: usize, S> UnwindSafe for Range3d<MCL, MCC, MPL, S>where
S: 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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more