pub struct TraversalSize { /* private fields */ }Expand description
Represents allowed sizes of a block of tiles
The size is represented as log2(size).
For example, TraversalSize { max: 6 } represents block of sizes up to 64 tiles.
Implementations§
Source§impl TraversalSize
impl TraversalSize
Sourcepub fn new(min_size: u32, max_size: u32) -> Result<TraversalSize>
pub fn new(min_size: u32, max_size: u32) -> Result<TraversalSize>
Create a new TraversalSize covering sizes from min_size up to max_size.
Both min_size and max_size must be positive powers of two, and min_size <= max_size.
§Errors
Returns an error if sizes are zero, not powers of two, out of order, or too large.
Sourcepub const fn new_default() -> Self
pub const fn new_default() -> Self
Return a default TraversalSize covering the full range of valid sizes (1 to 2^31).
Sourcepub fn new_max(size: u32) -> Result<TraversalSize>
pub fn new_max(size: u32) -> Result<TraversalSize>
Shortcut to create a TraversalSize with minimum size 1 and maximum size size.
pub fn is_full_range(&self) -> bool
Sourcepub fn max_size(&self) -> Result<u32>
pub fn max_size(&self) -> Result<u32>
Return the maximum allowed block size.
§Errors
Returns an error if the range is empty or max is out of bounds.
Sourcepub fn intersect(&mut self, other: &TraversalSize) -> Result<()>
pub fn intersect(&mut self, other: &TraversalSize) -> Result<()>
Restrict this range to the intersection with another TraversalSize.
§Errors
Returns an error if the resulting range is empty (no overlap).
pub fn get_intersected(&self, other: &TraversalSize) -> Result<TraversalSize>
Trait Implementations§
Source§impl Clone for TraversalSize
impl Clone for TraversalSize
Source§fn clone(&self) -> TraversalSize
fn clone(&self) -> TraversalSize
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for TraversalSize
impl Debug for TraversalSize
Source§impl Default for TraversalSize
impl Default for TraversalSize
Source§impl Display for TraversalSize
impl Display for TraversalSize
Source§impl PartialEq for TraversalSize
impl PartialEq for TraversalSize
impl StructuralPartialEq for TraversalSize
Auto Trait Implementations§
impl Freeze for TraversalSize
impl RefUnwindSafe for TraversalSize
impl Send for TraversalSize
impl Sync for TraversalSize
impl Unpin for TraversalSize
impl UnwindSafe for TraversalSize
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> 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<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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
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.Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.