pub trait TryFromValuewhere
    Self: Sized,
{ fn try_from_value(value: &Value, env: &Environment) -> Result<Self, Error>; }
Expand description

Implemented by types that can be constructed as owned from Values.

Required Methods

Tries to perform the conversion, returning an Error on failure.

Implementations on Foreign Types

Implementors

It is possible to accept arbitrary types implementing UserData as parameters to functions, however some limitations apply:

  • The UserData must implement Clone.
  • The UserData should be registered inside the engine the value comes from.
    • If the user data is ad hoc (not registered in the engine,) type errors will be less clear as the full Rust type name will be used.