Skip to main content

FarWith

Trait FarWith 

Source
pub trait FarWith<T>
where T: ?Sized,
{ // Required method fn there<C, R>( &self, anchor: Anchor, outer: &mut Bank<C>, f: impl FnOnce(&T) -> R, ) -> R where C: Group, R: BankSafe; }
Available on crate feature bank only.
Expand description

Borrowing a far pointer’s data across a bank boundary.

Switches into the data’s bank, lends &T to f, then restores the caller C: the cross-bank counterpart of Far::local. Implemented by Far (switch via scope, then local) and DynFar (switch to its runtime bank).

Required Methods§

Source

fn there<C, R>( &self, anchor: Anchor, outer: &mut Bank<C>, f: impl FnOnce(&T) -> R, ) -> R
where C: Group, R: BankSafe,

Switch into the data’s bank, lend &T to f, restore C.

anchor proves the caller is in bank 0: f runs across a bank switch, so its code must stay mapped. A #[bank] function holds no Anchor and so cannot call this (use local for same-bank data instead).

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<T, G> FarWith<T> for Far<T, G>
where G: Group, T: ?Sized,

Source§

impl<T> FarWith<T> for DynFar<T>
where T: ?Sized,