Trait debris_llir::debris_object::ObjectPayload
source · pub trait ObjectPayload: ValidPayload {
// Required method
fn memory_layout(&self) -> &MemoryLayout;
// Provided methods
fn create_class(&self, ctx: &TypeContext) -> ClassRef { ... }
fn runtime_class(&self, _ctx: &TypeContext) -> Option<ClassRef> { ... }
fn get_property(
&self,
_ctx: &TypeContext,
_ident: &Ident
) -> Option<ObjectRef> { ... }
fn json_fmt(&self, buf: &mut Vec<JsonFormatComponent>) { ... }
}
Expand description
A trait for values that can be used as debris object payload
The private ValidPayload
trait is auto-implemented
Required Methods§
sourcefn memory_layout(&self) -> &MemoryLayout
fn memory_layout(&self) -> &MemoryLayout
Returns the memory layout of this specific object This method is usually only called once
Provided Methods§
sourcefn 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
Per default the default class of the object type
sourcefn 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.
sourcefn 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
sourcefn 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