pub struct ViewBoundContext<T> {
pub data: T,
pub bound_at: ViewVersion,
pub bound_epoch: ViewEpoch,
}Expand description
A piece of user-supplied context data bound to a specific camera view.
The library does not interpret the contents — it only tracks whether the binding is still valid under the current view. Useful for calibration data, spatial regions, reference transforms, etc.
§Example
use nv_view::{ViewBoundContext, ViewState, BoundContextValidity};
struct CalibrationData { /* ... */ }
let view = ViewState::fixed_initial();
let bound = ViewBoundContext::bind(CalibrationData {}, &view);
// Same view → Current.
assert!(matches!(bound.validity(&view), BoundContextValidity::Current));Fields§
§data: TThe user’s data.
bound_at: ViewVersionThe ViewVersion at which this data was created or last rebind.
bound_epoch: ViewEpochThe ViewEpoch at which this data was created.
Implementations§
Source§impl<T> ViewBoundContext<T>
impl<T> ViewBoundContext<T>
Sourcepub fn validity(&self, current: &ViewState) -> BoundContextValidity
pub fn validity(&self, current: &ViewState) -> BoundContextValidity
Check whether this binding is still valid under the given view state.
Trait Implementations§
Source§impl<T: Clone> Clone for ViewBoundContext<T>
impl<T: Clone> Clone for ViewBoundContext<T>
Source§fn clone(&self) -> ViewBoundContext<T>
fn clone(&self) -> ViewBoundContext<T>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl<T> Freeze for ViewBoundContext<T>where
T: Freeze,
impl<T> RefUnwindSafe for ViewBoundContext<T>where
T: RefUnwindSafe,
impl<T> Send for ViewBoundContext<T>where
T: Send,
impl<T> Sync for ViewBoundContext<T>where
T: Sync,
impl<T> Unpin for ViewBoundContext<T>where
T: Unpin,
impl<T> UnsafeUnpin for ViewBoundContext<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for ViewBoundContext<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