Trait magnus::value::InnerRef

source ·
pub trait InnerRef {
    type Value: ReprValue;

    // Required method
    fn get_inner_ref_with<'a>(&'a self, ruby: &Ruby) -> &'a Self::Value;
}
Expand description

Helper trait for Ruby::get_inner_ref.

This trait allows for Ruby::get_inner_ref to get a reference to the inner value of both Opaque and Lazy.

Required Associated Types§

source

type Value: ReprValue

The specific Ruby value type.

Required Methods§

source

fn get_inner_ref_with<'a>(&'a self, ruby: &Ruby) -> &'a Self::Value

Get a reference to the inner value from self.

ruby acts as a token proving this is called from a Ruby thread and thus it is safe to access the inner value.

Implementors§

source§

impl<T> InnerRef for Lazy<T>
where T: ReprValue,

§

type Value = T

source§

impl<T> InnerRef for Opaque<T>
where T: ReprValue,

§

type Value = T