pub struct DispatchTable {
pub pretty_name: Rc<str>,
pub type_name: Rc<str>,
pub instance: Option<GcRaw<DispatchTable>>,
/* private fields */
}Expand description
A dispatch table containing functions bound to an instance of a value.
Fields§
§pretty_name: Rc<str>The pretty name of the type this dispatch table contains functions for.
type_name: Rc<str>§instance: Option<GcRaw<DispatchTable>>The “child” dispatch table that holds instance methods.
Implementations§
Source§impl DispatchTable
impl DispatchTable
Sourcepub fn new_for_type(type_name: impl Into<Rc<str>>) -> Self
pub fn new_for_type(type_name: impl Into<Rc<str>>) -> Self
Creates a new, empty type dispatch table with the given type name.
Sourcepub fn new_for_instance(type_name: impl Into<Rc<str>>) -> Self
pub fn new_for_instance(type_name: impl Into<Rc<str>>) -> Self
Creates a new, empty instance dispatch table with the given type name.
Sourcepub fn get_method(&self, index: u16) -> Option<GcRaw<Closure>>
pub fn get_method(&self, index: u16) -> Option<GcRaw<Closure>>
Returns a reference to the method at the given index.
Sourcepub fn set_method(&mut self, index: u16, closure: GcRaw<Closure>)
pub fn set_method(&mut self, index: u16, closure: GcRaw<Closure>)
Adds a method into the dispatch table.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for DispatchTable
impl !RefUnwindSafe for DispatchTable
impl !Send for DispatchTable
impl !Sync for DispatchTable
impl Unpin for DispatchTable
impl !UnwindSafe for DispatchTable
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