Skip to main content

Mutator

Struct Mutator 

Source
pub struct Mutator {
    pub tid: u16,
    pub rec: Arc<ThreadRecord>,
    /* private fields */
}

Fields§

§tid: u16§rec: Arc<ThreadRecord>

Implementations§

Source§

impl Mutator

Source

pub fn new(rec: Arc<ThreadRecord>) -> Self

Creates the context for an already-registered thread.

Source

pub fn heap_ptr(&self) -> *mut LocalHeap

Raw pointer to the allocator, for registration with the collector.

Source

pub fn release_pages(&mut self)

Returns the thread’s pages to the global pool (on thread exit, in native state).

Source

pub fn scope<R>(&mut self, f: impl FnOnce(&mut Mutator) -> R) -> R

Runs f with a handle scope; handles rooted inside are released afterwards.

Source

pub fn root(&mut self, v: Value) -> Handle

Source

pub fn get(&self, h: Handle) -> Value

Source

pub fn set(&mut self, h: Handle, v: Value)

Source

pub fn handle_values(&self) -> &[Value]

Root values for the GC (called while this thread is stopped).

Source

pub fn handles_ptr(&self) -> *const Vec<Value>

Pointer to the handle stack, for root sources that must not borrow the mutator.

Source

pub fn alloc_raw(&mut self, size: usize, cls: &'static Class) -> *mut Header

Source

pub fn alloc_instance(&mut self, cls: &'static Class) -> Value

Source

pub fn alloc_str(&mut self, s: &str) -> Value

Source

pub fn int_from_big(&mut self, b: BigInt) -> Value

Allocates a big integer, or returns a small int if it fits.

Source

pub fn int(&mut self, i: i64) -> Value

Source

pub fn alloc_list(&mut self, items: Vec<Value>) -> Value

Source

pub fn alloc_dict(&mut self, table: DictTable) -> Value

Source

pub fn alloc_set(&mut self, table: DictTable) -> Value

Source

pub fn alloc_tuple(&mut self, items: &[Value]) -> Value

Source

pub fn alloc_closure(&mut self, func: u32, caps: &[Value]) -> Value

Source

pub fn alloc_cell(&mut self, v: Value) -> Value

Source

pub fn alloc_string_builder(&mut self, s: String) -> Value

Source

pub fn alloc_mutex(&mut self, v: Value) -> Value

Source

pub fn alloc_atomic(&mut self, v: Value) -> Value

Source

pub fn alloc_channel(&mut self, capacity: usize) -> Value

Source

pub fn alloc_thread(&mut self) -> Value

Source

pub fn alloc_native(&mut self, data: Box<dyn NativeData>) -> Value

Source

pub fn alloc_range( &mut self, first: Value, last: Value, exclusive: bool, ) -> Value

Trait Implementations§

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.