Struct debris_llir::objects::obj_module::ObjModule
source · pub struct ObjModule {
pub ident: Ident,
pub members: ObjectProperties,
}
Expand description
A module object
Contains other values, including nested modules.
Fields§
§ident: Ident
The identifying name of this module
members: ObjectProperties
The members of this module
Implementations§
source§impl ObjModule
impl ObjModule
pub fn with_members(name: Ident, members: ObjectProperties) -> Self
pub fn members(&self) -> impl Iterator<Item = (&Ident, &ObjectRef)>
sourcepub fn set_property<T: Into<Ident>>(
&mut self,
name: T,
value: ObjectRef
) -> Option<ObjectRef>
pub fn set_property<T: Into<Ident>>( &mut self, name: T, value: ObjectRef ) -> Option<ObjectRef>
Sets a property
If it already exists, replaces the old value and returns it
sourcepub fn register<T: Into<Ident>>(&mut self, name: T, value: ObjectRef)
pub fn register<T: Into<Ident>>(&mut self, name: T, value: ObjectRef)
Registers a value for the first time
Panics if it already exists
sourcepub fn register_function(&mut self, ctx: &TypeContext, function: ObjFunction)
pub fn register_function(&mut self, ctx: &TypeContext, function: ObjFunction)
A more concise way to register builtin functions without having to declare its name twice.
Trait Implementations§
source§impl HasClass for ObjModule
impl HasClass for ObjModule
source§fn create_properties(ctx: &TypeContext) -> ObjectProperties
fn create_properties(ctx: &TypeContext) -> ObjectProperties
Returns all properties that belong to this class
source§fn static_class(ctx: &TypeContext) -> ClassRef
fn static_class(ctx: &TypeContext) -> ClassRef
Returns the static class that belongs to this Object
source§impl ObjectPayload for ObjModule
impl ObjectPayload for ObjModule
source§fn memory_layout(&self) -> &MemoryLayout
fn memory_layout(&self) -> &MemoryLayout
Returns the memory layout of this specific object
This method is usually only called once
source§fn get_property(&self, _ctx: &TypeContext, ident: &Ident) -> Option<ObjectRef>
fn get_property(&self, _ctx: &TypeContext, ident: &Ident) -> Option<ObjectRef>
May be overwritten by distinct payloads which carry properties
source§fn create_class(&self, ctx: &TypeContext) -> ClassRef
fn create_class(&self, ctx: &TypeContext) -> ClassRef
The class specific to this object.
Contains additionally to the class generics and the memory layout Read more
source§fn runtime_class(&self, _ctx: &TypeContext) -> Option<ClassRef>
fn runtime_class(&self, _ctx: &TypeContext) -> Option<ClassRef>
Returns the class which the runtime encodable variant of this object would have.
Used to determine the class passed into the
promote
method of objects.source§fn json_fmt(&self, buf: &mut Vec<JsonFormatComponent>)
fn json_fmt(&self, buf: &mut Vec<JsonFormatComponent>)
Converts this object into json components so it can be rendered in minecraft chat
source§impl PartialEq for ObjModule
impl PartialEq for ObjModule
impl Eq for ObjModule
impl StructuralEq for ObjModule
impl StructuralPartialEq for ObjModule
Auto Trait Implementations§
impl !RefUnwindSafe for ObjModule
impl !Send for ObjModule
impl !Sync for ObjModule
impl Unpin for ObjModule
impl !UnwindSafe for ObjModule
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
§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.