pub struct Lean<'l> { /* private fields */ }Expand description
A token that proves the Lean runtime is initialized.
This type is used throughout Leo3 to ensure that Lean objects are only
accessed when the runtime is properly initialized. The 'l lifetime
parameter ties all Lean objects to the initialization scope.
§Example
ⓘ
use leo3::prelude::*;
fn process_data<'l>(lean: Lean<'l>) -> LeanResult<()> {
// Create Lean objects using the token
let s = LeanString::mk(lean, "Hello");
Ok(())
}§Safety
The Lean<'l> token is typically created by with_lean() or similar
functions that ensure proper initialization. Users should not create
this token manually except in very specific circumstances.
Implementations§
Source§impl<'l> Lean<'l>
impl<'l> Lean<'l>
Sourcepub unsafe fn assume_initialized() -> Self
pub unsafe fn assume_initialized() -> Self
Create a new Lean<'l> token.
§Safety
The caller must ensure that the Lean runtime is properly initialized
before calling this function. This is typically done by calling
prepare_freethreaded_lean().
This function should generally not be called directly by users.
Use with_lean() instead.
Trait Implementations§
Auto Trait Implementations§
impl<'l> Freeze for Lean<'l>
impl<'l> RefUnwindSafe for Lean<'l>
impl<'l> !Send for Lean<'l>
impl<'l> !Sync for Lean<'l>
impl<'l> Unpin for Lean<'l>
impl<'l> UnwindSafe for Lean<'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