pub struct Local<L: LeanRepr> { /* private fields */ }Expand description
A Lean value of the type named by L, kept as the Lean object on the thread that made it.
The functions of the local module of a generated module return this handle. Its objects
keep the reference counts of one thread: passing the only handle of a value by value lets
the Lean function update the value in place, where a Lean handle makes it build new
objects. A Local cannot be sent to or shared with another thread; Local::share turns
it into a Lean that can.
ⓘ
let local = leanfran_runtime::Local::<u8>::new(1);
std::thread::spawn(move || drop(local));ⓘ
let local = leanfran_runtime::Local::<u8>::new(1);
std::thread::scope(|s| {
s.spawn(|| local.get());
});Implementations§
Trait Implementations§
impl<L: LeanRepr> IntoLean<L> for Local<L>
impl<L: LeanRepr> IntoLean<L> for &Local<L>
Auto Trait Implementations§
impl<L> !Send for Local<L>
impl<L> !Sync for Local<L>
impl<L> Forget for Local<L>
impl<L> Freeze for Local<L>
impl<L> Move for Local<L>
impl<L> RefUnwindSafe for Local<L>
impl<L> Unpin for Local<L>
impl<L> UnsafeUnpin for Local<L>
impl<L> UnwindSafe for Local<L>
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