pub struct AreaOfInterest<const MCL: usize, const MCC: usize, const MPL: usize, S> { /* private fields */ }Expand description
An AreaOfInterest is an Area together with a maximum number of entries it may include, and a maximum sum of total payload_lengths for the included entries.
A max_count of u64::MAX indicates that there is no limit on the number of entries. A max_size of u64::MAX indicates that there is no limit on the total payload_lengths of the entries.
use willow_data_model::prelude::*;
let aoi = AreaOfInterest::new(
Area::<2, 2, 2, u8>::new(None, Path::new(), TimeRange::new_closed(0.into(), 17.into())),
NonZeroU64::new(5).unwrap(),
400,
);
assert_eq!(aoi.area(), &Area::<2, 2, 2, u8>::new(None, Path::new(), TimeRange::new_closed(0.into(), 17.into())));
assert_eq!(aoi.max_count(), NonZeroU64::new(5).unwrap());
assert_eq!(aoi.max_size(), 400);Implementations§
Source§impl<const MCL: usize, const MCC: usize, const MPL: usize, S> AreaOfInterest<MCL, MCC, MPL, S>
impl<const MCL: usize, const MCC: usize, const MPL: usize, S> AreaOfInterest<MCL, MCC, MPL, S>
Sourcepub fn new(
area: Area<MCL, MCC, MPL, S>,
max_count: NonZeroU64,
max_size: u64,
) -> Self
pub fn new( area: Area<MCL, MCC, MPL, S>, max_count: NonZeroU64, max_size: u64, ) -> Self
Creates a new AreaOfInterest from its constituent Area, max_count, and max_size.
A max_count of u64::MAX indicates that there is no limit on the number of entries. A max_size of u64::MAX indicates that there is no limit on the total payload_lengths of the entries.
use willow_data_model::prelude::*;
let aoi = AreaOfInterest::new(
Area::<2, 2, 2, u8>::new(None, Path::new(), TimeRange::new_closed(0.into(), 17.into())),
NonZeroU64::new(5).unwrap(),
400,
);
assert_eq!(
aoi.area(),
&Area::<2, 2, 2, u8>::new(None, Path::new(), TimeRange::new_closed(0.into(), 17.into())),
);
assert_eq!(aoi.max_count(), NonZeroU64::new(5).unwrap());
assert_eq!(aoi.max_size(), 400);Sourcepub fn area(&self) -> &Area<MCL, MCC, MPL, S>
pub fn area(&self) -> &Area<MCL, MCC, MPL, S>
Returns a reference to the inner Area.
use willow_data_model::prelude::*;
let aoi = AreaOfInterest::new(
Area::<2, 2, 2, u8>::new(None, Path::new(), TimeRange::new_closed(0.into(), 17.into())),
NonZeroU64::new(5).unwrap(),
400,
);
assert_eq!(aoi.area(), &Area::<2, 2, 2, u8>::new(None, Path::new(), TimeRange::new_closed(0.into(), 17.into())));Sourcepub fn max_count(&self) -> NonZeroU64
pub fn max_count(&self) -> NonZeroU64
Returns the max_count of entries.
A max_count of u64::MAX indicates that there is no limit on the number of entries in this area of interest.
use willow_data_model::prelude::*;
let aoi = AreaOfInterest::new(
Area::<2, 2, 2, u8>::new(None, Path::new(), TimeRange::new_closed(0.into(), 17.into())),
NonZeroU64::new(5).unwrap(),
400,
);
assert_eq!(aoi.max_count(), NonZeroU64::new(5).unwrap());Sourcepub fn max_size(&self) -> u64
pub fn max_size(&self) -> u64
Returns the max_count of entries.
A max_size of u64::MAX indicates that there is no limit on the total payload_lengths of the entries in this area of interest.
use willow_data_model::prelude::*;
let aoi = AreaOfInterest::new(
Area::<2, 2, 2, u8>::new(None, Path::new(), TimeRange::new_closed(0.into(), 17.into())),
NonZeroU64::new(5).unwrap(),
400,
);
assert_eq!(aoi.max_size(), 400);Sourcepub fn set_max_count(&mut self, new_max_count: NonZeroU64)
pub fn set_max_count(&mut self, new_max_count: NonZeroU64)
Sourcepub fn set_max_size(&mut self, new_max_size: u64)
pub fn set_max_size(&mut self, new_max_size: u64)
Sets the max_size.
A max_size of u64::MAX indicates that there is no limit on the total payload_lengths of the entries in this area of interest.
Source§impl<const MCL: usize, const MCC: usize, const MPL: usize, S> AreaOfInterest<MCL, MCC, MPL, S>
impl<const MCL: usize, const MCC: usize, const MPL: usize, S> AreaOfInterest<MCL, MCC, MPL, S>
Sourcepub fn intersection(&self, other: &Self) -> Result<Self, EmptyGrouping>
pub fn intersection(&self, other: &Self) -> Result<Self, EmptyGrouping>
Returns the intersection of self and other.
use willow_data_model::prelude::*;
let aoi1 = AreaOfInterest::new(
Area::<2, 2, 2, u8>::new(None, Path::new(), TimeRange::new_closed(0.into(), 17.into())),
NonZeroU64::new(5).unwrap(),
400,
);
let aoi2 = AreaOfInterest::new(
Area::<2, 2, 2, u8>::new(None, Path::new(), TimeRange::new_open(14.into())),
NonZeroU64::new(12).unwrap(),
32,
);
assert_eq!(
aoi1.intersection(&aoi2),
Ok(AreaOfInterest::new(
Area::<2, 2, 2, u8>::new(
None,
Path::new(),
TimeRange::new_closed(14.into(), 17.into()),
),
NonZeroU64::new(5).unwrap(),
32,
)),
);Trait Implementations§
Source§impl<'arbitrary, const MCL: usize, const MCC: usize, const MPL: usize, S: Arbitrary<'arbitrary>> Arbitrary<'arbitrary> for AreaOfInterest<MCL, MCC, MPL, S>
impl<'arbitrary, const MCL: usize, const MCC: usize, const MPL: usize, S: Arbitrary<'arbitrary>> Arbitrary<'arbitrary> for AreaOfInterest<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 AreaOfInterest<MCL, MCC, MPL, S>
impl<const MCL: usize, const MCC: usize, const MPL: usize, S: Clone> Clone for AreaOfInterest<MCL, MCC, MPL, S>
Source§fn clone(&self) -> AreaOfInterest<MCL, MCC, MPL, S>
fn clone(&self) -> AreaOfInterest<MCL, MCC, MPL, S>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<const MCL: usize, const MCC: usize, const MPL: usize, S: Debug> Debug for AreaOfInterest<MCL, MCC, MPL, S>
impl<const MCL: usize, const MCC: usize, const MPL: usize, S: Debug> Debug for AreaOfInterest<MCL, MCC, MPL, S>
Source§impl<const MCL: usize, const MCC: usize, const MPL: usize, S> GreatestElement for AreaOfInterest<MCL, MCC, MPL, S>
impl<const MCL: usize, const MCC: usize, const MPL: usize, S> GreatestElement for AreaOfInterest<MCL, MCC, MPL, S>
Source§impl<const MCL: usize, const MCC: usize, const MPL: usize, S: Hash> Hash for AreaOfInterest<MCL, MCC, MPL, S>
impl<const MCL: usize, const MCC: usize, const MPL: usize, S: Hash> Hash for AreaOfInterest<MCL, MCC, MPL, S>
Source§impl<const MCL: usize, const MCC: usize, const MPL: usize, S: PartialEq> PartialEq for AreaOfInterest<MCL, MCC, MPL, S>
impl<const MCL: usize, const MCC: usize, const MPL: usize, S: PartialEq> PartialEq for AreaOfInterest<MCL, MCC, MPL, S>
Source§fn eq(&self, other: &AreaOfInterest<MCL, MCC, MPL, S>) -> bool
fn eq(&self, other: &AreaOfInterest<MCL, MCC, MPL, S>) -> bool
self and other values to be equal, and is used by ==.Source§impl<const MCL: usize, const MCC: usize, const MPL: usize, S> PartialOrd for AreaOfInterest<MCL, MCC, MPL, S>
impl<const MCL: usize, const MCC: usize, const MPL: usize, S> PartialOrd for AreaOfInterest<MCL, MCC, MPL, S>
This implementation assumes that S is inhabited by more than one value.
impl<const MCL: usize, const MCC: usize, const MPL: usize, S: Eq> Eq for AreaOfInterest<MCL, MCC, MPL, S>
impl<const MCL: usize, const MCC: usize, const MPL: usize, S> StructuralPartialEq for AreaOfInterest<MCL, MCC, MPL, S>
Auto Trait Implementations§
impl<const MCL: usize, const MCC: usize, const MPL: usize, S> !Freeze for AreaOfInterest<MCL, MCC, MPL, S>
impl<const MCL: usize, const MCC: usize, const MPL: usize, S> RefUnwindSafe for AreaOfInterest<MCL, MCC, MPL, S>where
S: RefUnwindSafe,
impl<const MCL: usize, const MCC: usize, const MPL: usize, S> Send for AreaOfInterest<MCL, MCC, MPL, S>where
S: Send,
impl<const MCL: usize, const MCC: usize, const MPL: usize, S> Sync for AreaOfInterest<MCL, MCC, MPL, S>where
S: Sync,
impl<const MCL: usize, const MCC: usize, const MPL: usize, S> Unpin for AreaOfInterest<MCL, MCC, MPL, S>where
S: Unpin,
impl<const MCL: usize, const MCC: usize, const MPL: usize, S> UnwindSafe for AreaOfInterest<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