Trait typst::foundations::Reflect
source · pub trait Reflect {
// Required methods
fn input() -> CastInfo;
fn output() -> CastInfo;
fn castable(value: &Value) -> bool;
// Provided method
fn error(found: &Value) -> EcoString { ... }
}Expand description
Determine details of a type.
Type casting works as follows:
Reflect for Tdescribes the possible Typst values forT(for documentation and autocomplete).IntoValue for Tis for conversion fromT -> Value(infallible)FromValue for Tis for conversion fromValue -> T(fallible).
We can’t use TryFrom<Value> due to conflicting impls. We could use
From<T> for Value, but that inverses the impl and leads to tons of
.into() all over the place that become hard to decipher.
Required Methods§
Provided Methods§
Object Safety§
This trait is not object safe.