pub struct AreaOfInterest { /* 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 willow25::prelude::*;
let aoi = AreaOfInterest::new(
Area::new(None, Path::new(), TimeRange::new_closed(0.into(), 17.into())),
NonZeroU64::new(5).unwrap(),
400,
);
assert_eq!(
aoi.area(),
&Area::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 AreaOfInterest
impl AreaOfInterest
Sourcepub fn new(area: Area, max_count: NonZeroU64, max_size: u64) -> Self
pub fn new(area: Area, 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 willow25::prelude::*;
let aoi = AreaOfInterest::new(
Area::new(None, Path::new(), TimeRange::new_closed(0.into(), 17.into())),
NonZeroU64::new(5).unwrap(),
400,
);;
assert_eq!(
aoi.area(),
&Area::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
pub fn area(&self) -> &Area
Returns a reference to the inner Area.
use willow25::prelude::*;
let aoi = AreaOfInterest::new(
Area::new(None, Path::new(), TimeRange::new_closed(0.into(), 17.into())),
NonZeroU64::new(5).unwrap(),
400,
);;
assert_eq!(
aoi.area(),
&Area::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 willow25::prelude::*;
let aoi = AreaOfInterest::new(
Area::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 willow25::prelude::*;
let aoi = AreaOfInterest::new(
Area::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 AreaOfInterest
impl AreaOfInterest
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 willow25::prelude::*;
let aoi1 = AreaOfInterest::new(
Area::new(None, Path::new(), TimeRange::new_closed(0.into(), 17.into())),
NonZeroU64::new(5).unwrap(),
400,
);
let aoi2 = AreaOfInterest::new(
Area::new(None, Path::new(), TimeRange::new_open(14.into())),
NonZeroU64::new(12).unwrap(),
32,
);
assert_eq!(
aoi1.intersection(&aoi2),
Ok(AreaOfInterest::new(
Area::new(
None,
Path::new(),
TimeRange::new_closed(14.into(), 17.into())
),
NonZeroU64::new(5).unwrap(),
32,
)),
);Trait Implementations§
Source§impl Clone for AreaOfInterest
impl Clone for AreaOfInterest
Source§impl Debug for AreaOfInterest
impl Debug for AreaOfInterest
impl Eq for AreaOfInterest
Source§impl GreatestElement for AreaOfInterest
impl GreatestElement for AreaOfInterest
Source§impl Hash for AreaOfInterest
impl Hash for AreaOfInterest
Source§impl PartialEq for AreaOfInterest
impl PartialEq for AreaOfInterest
Source§impl PartialOrd for AreaOfInterest
impl PartialOrd for AreaOfInterest
This implementation assumes that S is inhabited by more than one value.
impl StructuralPartialEq for AreaOfInterest
Auto Trait Implementations§
impl !Freeze for AreaOfInterest
impl Forget for AreaOfInterest
impl RefUnwindSafe for AreaOfInterest
impl Send for AreaOfInterest
impl Sync for AreaOfInterest
impl Unpin for AreaOfInterest
impl UnsafeUnpin for AreaOfInterest
impl UnwindSafe for AreaOfInterest
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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