pub trait FromNeoValue: Sized {
// Required method
fn from_value(value: &NeoValue) -> Result<Self, NeoError>;
}Expand description
A type that can be deserialised from a NeoVM StackItem /
NeoValue. This is the L9 IInteroperable equivalent in
the C# devpack: any contract return type (or argument type)
implements this trait, enabling NeoContract::call_typed<T>
to round-trip the on-chain value into a typed Rust value.
The default from_value for the common types (NeoInteger,
NeoBoolean, NeoByteString, NeoString) is provided;
contract-specific types (e.g. a custom Token struct) can
implement it by parsing the underlying NeoValue into the
concrete type.
Required Methods§
Sourcefn from_value(value: &NeoValue) -> Result<Self, NeoError>
fn from_value(value: &NeoValue) -> Result<Self, NeoError>
Convert a NeoValue into Self. Returns an error if
the value’s runtime type doesn’t match Self’s expected
type (e.g. trying to extract an Integer from a String).
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".