pub trait Object<'a>: Debug {
// Required method
fn type_name(&self) -> &'static str;
// Provided methods
fn as_any(&self) -> Option<&dyn Any> { ... }
fn underlying(&self) -> Option<&Value<'a>> { ... }
fn field(&self, _name: &str) -> Option<Value<'a>> { ... }
fn method(
&self,
_name: &str,
_args: Vec<Arg<'a, '_>>,
) -> Option<Result<Value<'a>>> { ... }
fn call(&self, _args: &[Value<'a>]) -> Option<Result<Value<'a>>> { ... }
fn is_callable(&self) -> bool { ... }
fn display(&self) -> Result<String> { ... }
fn display_text(&self) -> Option<&str> { ... }
fn is_trusted_html(&self) -> bool { ... }
fn entries(&self, _limit: usize) -> Result<Vec<(Value<'a>, Value<'a>)>> { ... }
fn json_kind(&self) -> JsonKind<'_> { ... }
}Expand description
A per-render engine object such as a slot, closure, date or attribute bag.
Required Methods§
Provided Methods§
Sourcefn as_any(&self) -> Option<&dyn Any>
fn as_any(&self) -> Option<&dyn Any>
Exposes a static object for native downcasting when supported.
Sourcefn underlying(&self) -> Option<&Value<'a>>
fn underlying(&self) -> Option<&Value<'a>>
Borrows the value represented by a transparent display wrapper, if present.
Sourcefn method(
&self,
_name: &str,
_args: Vec<Arg<'a, '_>>,
) -> Option<Result<Value<'a>>>
fn method( &self, _name: &str, _args: Vec<Arg<'a, '_>>, ) -> Option<Result<Value<'a>>>
Calls an exposed method.
Sourcefn call(&self, _args: &[Value<'a>]) -> Option<Result<Value<'a>>>
fn call(&self, _args: &[Value<'a>]) -> Option<Result<Value<'a>>>
Calls a callable object, if applicable.
Sourcefn is_callable(&self) -> bool
fn is_callable(&self) -> bool
Indicates whether this object can be passed as a closure.
Sourcefn display_text(&self) -> Option<&str>
fn display_text(&self) -> Option<&str>
Borrows the printable representation when it is already stored as text.
If supplied, this must match the text returned by display.
Sourcefn is_trusted_html(&self) -> bool
fn is_trusted_html(&self) -> bool
Indicates that the object’s printable representation is trusted HTML.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".