pub trait ObjectCompat: Object {
Show 19 methods
// Provided methods
fn class(&self, cx: &mut Cx) -> Result<ClassRef> { ... }
fn as_callable(&self) -> Option<&dyn Callable> { ... }
fn as_class(&self) -> Option<&dyn Class> { ... }
fn as_shape(&self) -> Option<&dyn Shape> { ... }
fn as_object_encoder(&self) -> Option<&dyn ObjectEncode> { ... }
fn as_read_constructor(&self) -> Option<&dyn ReadConstructor> { ... }
fn as_number_domain(&self) -> Option<&dyn NumberDomain> { ... }
fn as_number_value(&self) -> Option<&dyn NumberValue> { ... }
fn as_eval_fabric(&self) -> Option<&dyn EvalFabric> { ... }
fn as_stream(&self) -> Option<&dyn Stream> { ... }
fn as_sequence(&self) -> Option<&dyn Sequence> { ... }
fn as_thunk(&self) -> Option<&dyn Thunk> { ... }
fn as_list(&self) -> Option<&dyn ListValue> { ... }
fn as_table_impl(&self) -> Option<&dyn Table> { ... }
fn as_dir(&self) -> Option<&dyn Dir> { ... }
fn as_expr(&self, cx: &mut Cx) -> Result<Expr> { ... }
fn truth(&self, _cx: &mut Cx) -> Result<bool> { ... }
fn publish_shape_satisfaction_claims(
&self,
_cx: &mut Cx,
_shape: &Ref,
) -> Result<bool> { ... }
fn as_table(&self, cx: &mut Cx) -> Result<Value> { ... }
}Expand description
Bridge that exposes typed protocol views (class, callable, shape, encoder, number, fabric, stream, and related accessors) for objects that do not resolve them through operations.
Callers should resolve operations, claims, refs, or snapshots instead of
calling this trait. It is kept outside Object so the root object trait
stays minimal while library objects expose this behavior through
compatibility adapters.
Provided Methods§
Sourcefn class(&self, cx: &mut Cx) -> Result<ClassRef>
fn class(&self, cx: &mut Cx) -> Result<ClassRef>
Class object this value belongs to; defaults to nil.
Sourcefn as_callable(&self) -> Option<&dyn Callable>
fn as_callable(&self) -> Option<&dyn Callable>
Callable view, if the object can be invoked.
Sourcefn as_object_encoder(&self) -> Option<&dyn ObjectEncode>
fn as_object_encoder(&self) -> Option<&dyn ObjectEncode>
Object-encoder view, if the object encodes other objects.
Sourcefn as_read_constructor(&self) -> Option<&dyn ReadConstructor>
fn as_read_constructor(&self) -> Option<&dyn ReadConstructor>
Read-constructor view, if the object decodes data forms.
Sourcefn as_number_domain(&self) -> Option<&dyn NumberDomain>
fn as_number_domain(&self) -> Option<&dyn NumberDomain>
Number-domain view, if the object is a number domain.
Sourcefn as_number_value(&self) -> Option<&dyn NumberValue>
fn as_number_value(&self) -> Option<&dyn NumberValue>
Number-value view, if the object is a domain number.
Sourcefn as_eval_fabric(&self) -> Option<&dyn EvalFabric>
fn as_eval_fabric(&self) -> Option<&dyn EvalFabric>
Eval-fabric view, if the object is a distributed eval surface.
Sourcefn as_sequence(&self) -> Option<&dyn Sequence>
fn as_sequence(&self) -> Option<&dyn Sequence>
Sequence view, if the object is a sequence.
Sourcefn as_table_impl(&self) -> Option<&dyn Table>
fn as_table_impl(&self) -> Option<&dyn Table>
Table-implementation view, if the object is a table.
Sourcefn as_expr(&self, cx: &mut Cx) -> Result<Expr>
fn as_expr(&self, cx: &mut Cx) -> Result<Expr>
Expression form of the object; defaults to an opaque extension node.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".