Trait FromValue

Source
pub trait FromValue<'a>: Sized {
    // Required method
    fn from_value(
        ctx: &FromValueContext<'a>,
        value: &'a Value,
    ) -> Result<Self, FromValueError>;
}
Expand description

Implemented for any type that can be created from a Ruby Value.

Required Methods§

Source

fn from_value( ctx: &FromValueContext<'a>, value: &'a Value, ) -> Result<Self, FromValueError>

Create this type from the given value from the ValueArena.

§Arguments
  1. ctx: The value extraction context.
  2. handle: The handle that points to the value to convert.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<'a> FromValue<'a> for bool

Source§

fn from_value( ctx: &FromValueContext<'a>, value: &'a Value, ) -> Result<Self, FromValueError>

Source§

impl<'a> FromValue<'a> for i32

Source§

fn from_value( ctx: &FromValueContext<'a>, value: &'a Value, ) -> Result<Self, FromValueError>

Source§

impl<'a, K, V> FromValue<'a> for BTreeMap<K, V>
where K: FromValue<'a> + Eq + Ord, V: FromValue<'a>,

Source§

fn from_value( ctx: &FromValueContext<'a>, value: &'a Value, ) -> Result<Self, FromValueError>

Source§

impl<'a, K, V> FromValue<'a> for HashMap<K, V>
where K: FromValue<'a> + Hash + Eq, V: FromValue<'a>,

Source§

fn from_value( ctx: &FromValueContext<'a>, value: &'a Value, ) -> Result<Self, FromValueError>

Source§

impl<'a, T> FromValue<'a> for Option<T>
where T: FromValue<'a>,

Source§

fn from_value( ctx: &FromValueContext<'a>, value: &'a Value, ) -> Result<Self, FromValueError>

Source§

impl<'a, T> FromValue<'a> for Vec<T>
where T: FromValue<'a>,

Source§

fn from_value( ctx: &FromValueContext<'a>, value: &'a Value, ) -> Result<Self, FromValueError>

Implementors§

Source§

impl<'a> FromValue<'a> for &'a Value

Source§

impl<'a> FromValue<'a> for &'a ArrayValue

Source§

impl<'a> FromValue<'a> for &'a BoolValue

Source§

impl<'a> FromValue<'a> for &'a FixnumValue

Source§

impl<'a> FromValue<'a> for &'a HashValue

Source§

impl<'a> FromValue<'a> for &'a NilValue

Source§

impl<'a> FromValue<'a> for &'a ObjectValue

Source§

impl<'a> FromValue<'a> for &'a StringValue

Source§

impl<'a> FromValue<'a> for &'a SymbolValue

Source§

impl<'a> FromValue<'a> for &'a UserDefinedValue