[−][src]Struct cursive::view::SizeCache
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: usize
Cached value
constrained: bool
true
if the last size was constrained.
If unconstrained, any request larger than this value would return the same size.
extra: T
Extra field.
Implementations
impl SizeCache<()>
[src]
pub fn new(value: usize, constrained: bool) -> SizeCache<()>
[src]
Creates a new sized cache
pub fn build(size: XY<usize>, req: XY<usize>) -> XY<SizeCache<()>>
[src]
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:
size
must fit insidereq
.- for each dimension,
constrained = (size == req)
impl<T> SizeCache<T>
[src]
pub fn new_extra(value: usize, constrained: bool, extra: T) -> SizeCache<T>
[src]
Creates a new sized cache
pub fn build_extra(
size: XY<usize>,
req: XY<usize>,
extra: XY<T>
) -> XY<SizeCache<T>>
[src]
size: XY<usize>,
req: XY<usize>,
extra: XY<T>
) -> XY<SizeCache<T>>
Creates a new bi-dimensional cache.
Similar to build()
, but includes the extra field.
pub fn accept(self, request: usize) -> bool
[src]
Returns true
if self
is still valid for the given request
.
pub fn value(self) -> usize
[src]
Returns the value in the cache.
Trait Implementations
impl<T> Clone for SizeCache<T> where
T: Clone,
[src]
T: Clone,
impl<T> Copy for SizeCache<T> where
T: Copy,
[src]
T: Copy,
impl<T> Debug for SizeCache<T> where
T: Debug,
[src]
T: Debug,
impl<T> PartialEq<SizeCache<T>> for SizeCache<T> where
T: PartialEq<T>,
[src]
T: PartialEq<T>,
pub fn eq(&self, other: &SizeCache<T>) -> bool
[src]
pub fn ne(&self, other: &SizeCache<T>) -> bool
[src]
impl<T> StructuralPartialEq for SizeCache<T>
[src]
Auto Trait Implementations
impl<T> RefUnwindSafe for SizeCache<T> where
T: RefUnwindSafe,
[src]
T: RefUnwindSafe,
impl<T> Send for SizeCache<T> where
T: Send,
[src]
T: Send,
impl<T> Sync for SizeCache<T> where
T: Sync,
[src]
T: Sync,
impl<T> Unpin for SizeCache<T> where
T: Unpin,
[src]
T: Unpin,
impl<T> UnwindSafe for SizeCache<T> where
T: UnwindSafe,
[src]
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Erased for T
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> With for T
[src]
pub fn wrap_with<U, F>(self, f: F) -> U where
F: FnOnce(Self) -> U,
[src]
F: FnOnce(Self) -> U,
pub fn with<F>(self, f: F) -> Self where
F: FnOnce(&mut Self),
[src]
F: FnOnce(&mut Self),
pub fn try_with<E, F>(self, f: F) -> Result<Self, E> where
F: FnOnce(&mut Self) -> Result<(), E>,
[src]
F: FnOnce(&mut Self) -> Result<(), E>,
pub fn with_if<F>(self, condition: bool, f: F) -> Self where
F: FnOnce(&mut Self),
[src]
F: FnOnce(&mut Self),