Struct cursive_core::view::SizeCache
source · pub struct SizeCache<T = ()> {
pub value: usize,
pub constrained: bool,
pub extra: T,
}Expand description
Cache around a one-dimensional layout result.
This is not a View, but something to help you if you create your own Views.
Fields§
§value: usizeCached value
constrained: booltrue if the last size was constrained.
If unconstrained, any request larger than this value would return the same size.
extra: TExtra field.
Implementations§
source§impl SizeCache<()>
impl SizeCache<()>
sourcepub fn build(size: Vec2, req: Vec2) -> XY<Self>
pub fn build(size: Vec2, req: Vec2) -> XY<Self>
Creates a new bi-dimensional cache.
It will stay valid for the same request, and compatible ones.
A compatible request is one where, for each axis, either:
- the request is equal to the cached size, or
- the request is larger than the cached size and the cache is unconstrained
Notes:
sizemust fit insidereq.- for each dimension,
constrained = (size == req)
Trait Implementations§
impl<T: Copy> Copy for SizeCache<T>
impl<T: Eq> Eq for SizeCache<T>
impl<T> StructuralPartialEq for SizeCache<T>
Auto Trait Implementations§
impl<T> Freeze for SizeCache<T>where
T: Freeze,
impl<T> RefUnwindSafe for SizeCache<T>where
T: RefUnwindSafe,
impl<T> Send for SizeCache<T>where
T: Send,
impl<T> Sync for SizeCache<T>where
T: Sync,
impl<T> Unpin for SizeCache<T>where
T: Unpin,
impl<T> UnwindSafe for SizeCache<T>where
T: 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
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit)source§impl<T> CloneToUninit for Twhere
T: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit)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
Compare self to
key and return true if they are equal.