pub struct DynFar<T>where
T: ?Sized,{ /* private fields */ }Available on crate feature
bank only.Expand description
A far pointer whose bank is known only at runtime: a group-erased Far.
DynFar is the no-alloc, vtable-free type erasure of Far: the group type
becomes a BankNumber stored inline, so far pointers of different banks
share one type and can live in the same collection. Every access switches to the
stored bank (there is no compile-time group to elide it against).
Obtain one with Far::erase.
§Examples
ⓘ
fn run_each(bank: &mut Bank<GroupZero>, behaviours: &[DynFar<fn(u8)>], state: u8) {
for b in behaviours {
b.invoke(bank, (state,)); // switch to each one's bank, run, restore
}
}Trait Implementations§
impl<T> BankSafe for DynFar<T>where
T: ?Sized,
impl<T> Copy for DynFar<T>where
T: ?Sized,
impl<T> Sync for DynFar<T>where
T: ?Sized,
Auto Trait Implementations§
impl<T> !Send for DynFar<T>
impl<T> Freeze for DynFar<T>where
T: ?Sized,
impl<T> RefUnwindSafe for DynFar<T>where
T: RefUnwindSafe + ?Sized,
impl<T> Unpin for DynFar<T>where
T: ?Sized,
impl<T> UnsafeUnpin for DynFar<T>where
T: ?Sized,
impl<T> UnwindSafe for DynFar<T>where
T: RefUnwindSafe + ?Sized,
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