[][src]Struct emacs::Value

pub struct Value<'e> {
    pub env: &'e Env,
    // some fields omitted

A type that represents Lisp values. Values of this type can be copied around, but are lifetime-bound to the Env they come from.

They are also "proxy values" that are only useful when converted to Rust values, or used as arguments when calling back into the Lisp runtime.


env: &'e Env


impl<'e> Value<'e>[src]

pub fn is_not_nil(&self) -> bool[src]

pub fn eq(&self, other: Value<'e>) -> bool[src]

pub fn into_rust<T: FromLisp<'e>>(self) -> Result<T>[src]

Converts this value into a Rust value of the given type.

pub fn into_ref<T: 'static>(self) -> Result<Ref<'e, T>>[src]

pub fn into_ref_mut<T: 'static>(self) -> Result<RefMut<'e, T>>[src]

pub unsafe fn get_mut<T: Transfer>(&mut self) -> Result<&mut T>[src]

Returns a mutable reference to the underlying Rust data wrapped by this value.


There are several ways this can go wrong:

  • Lisp code can pass the same object through 2 different values in an argument list.
  • Rust code earlier in the call chain may have copied this value.
  • Rust code later in the call chain may receive a copy of this value.

In general, it is better to wrap Rust data in RefCell, Mutex, or RwLock guards, before moving them to Lisp, and then only access them through these guards (which can be obtained back through into_rust). This method is for squeezing out the last bit of performance in very rare situations.

impl<'e> Value<'e>[src]

pub fn call<A>(self, args: A) -> Result<Value<'e>> where
    A: IntoLispArgs<'e>, 

Calls this value with the given arguments. An error is signaled if it is actually not a Lisp's callable.

args should be an array/slice of Value, or a tuple of different types, each implementing IntoLisp.


fn mapc_enumerate_vec(function: Value, vector: Vector) -> Result<()> {
    for nth in 0..vector.size()? {
        let elem: Value = vector.get(nth)?;
        function.call((nth, elem))?;

Trait Implementations

impl<'a, 'e: 'a> FromLisp<'e> for Value<'a>[src]

impl<'e> IntoLisp<'e> for Value<'e>[src]

impl<'e> Clone for Value<'e>[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl<'e> Copy for Value<'e>[src]

impl<'e> Debug for Value<'e>[src]

Auto Trait Implementations

impl<'e> !Sync for Value<'e>

impl<'e> !Send for Value<'e>

impl<'e> Unpin for Value<'e>

impl<'e> !RefUnwindSafe for Value<'e>

impl<'e> !UnwindSafe for Value<'e>

Blanket Implementations

impl<T> ToOwned for T where
    T: Clone

type Owned = T

The resulting type after obtaining ownership.

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized

impl<T> Borrow<T> for T where
    T: ?Sized

impl<T> Any for T where
    T: 'static + ?Sized