pub trait Class: Callable {
// Required methods
fn id(&self) -> ClassId;
fn symbol(&self) -> Symbol;
fn constructor_shape(&self, cx: &mut Cx) -> Result<ShapeRef>;
fn instance_shape(&self, cx: &mut Cx) -> Result<ShapeRef>;
fn read_constructor(
&self,
cx: &mut Cx,
) -> Result<Option<ReadConstructorRef>>;
fn members(&self, cx: &mut Cx) -> Result<TableRef>;
// Provided methods
fn parents(&self, _cx: &mut Cx) -> Result<Vec<ClassRef>> { ... }
fn is_subclass_of(&self, cx: &mut Cx, expected: ClassRef) -> Result<bool>
where Self: Sized { ... }
}Expand description
Runtime protocol for class objects.
Classes are callable constructor values with stable identity, shape metadata, read-constructor support, and browseable members.
Required Methods§
Sourcefn constructor_shape(&self, cx: &mut Cx) -> Result<ShapeRef>
fn constructor_shape(&self, cx: &mut Cx) -> Result<ShapeRef>
Shape describing the arguments accepted by the constructor.
Sourcefn instance_shape(&self, cx: &mut Cx) -> Result<ShapeRef>
fn instance_shape(&self, cx: &mut Cx) -> Result<ShapeRef>
Shape describing instances produced by the class.
Sourcefn read_constructor(&self, cx: &mut Cx) -> Result<Option<ReadConstructorRef>>
fn read_constructor(&self, cx: &mut Cx) -> Result<Option<ReadConstructorRef>>
Optional read-constructor for decoding instances from data forms.
Provided Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".