[][src]Struct emacs::Env

pub struct Env { /* fields omitted */ }

Main point of interaction with the Lisp runtime.

Methods

impl Env[src]

Public APIs.

pub fn intern(&self, name: &str) -> Result<Value>[src]

pub fn type_of<'e>(&'e self, value: Value<'e>) -> Result<Value>[src]

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

Deprecated since 0.10.0:

Please use value.is_not_nil() instead

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

Deprecated since 0.10.0:

Please use value1.eq(value2) instead

pub fn cons<'e, A, B>(&'e self, car: A, cdr: B) -> Result<Value> where
    A: IntoLisp<'e>,
    B: IntoLisp<'e>, 
[src]

pub fn list<'e, A>(&'e self, args: A) -> Result<Value> where
    A: IntoLispArgs<'e>, 
[src]

pub fn provide(&self, name: &str) -> Result<Value>[src]

pub fn message<T: AsRef<str>>(&self, text: T) -> Result<Value>[src]

impl Env[src]

pub unsafe fn make_user_ptr(
    &self,
    fin: emacs_finalizer_function,
    ptr: *mut c_void
) -> Result<Value>
[src]

Creates and returns a user-ptr object that wraps the raw pointer ptr. When the object is garbage-collected, fin will be called with ptr as the only argument. If fin is None, no finalization will be done.

In general, prefer the user-ptr supported provided by the defun attr macro. Use this function only for special user-ptr types, such as newtypes wrapping opaque pointers.

Safety

The pointer must be valid until the finalizer is called. The finalizer itself must finalize the pointer in a safe manner.

impl Env[src]

pub fn make_vector<'e, T: IntoLisp<'e>>(
    &'e self,
    length: usize,
    init: T
) -> Result<Vector>
[src]

pub fn vector<'e, A: IntoLispArgs<'e>>(&'e self, args: A) -> Result<Vector>[src]

impl Env[src]

pub fn call<'e, F, A>(&'e self, func: F, args: A) -> Result<Value> where
    F: IntoLispCallable<'e>,
    A: IntoLispArgs<'e>, 
[src]

Calls a Lisp function, passing the given arguments.

  • func should be a string, or a Lisp's callable Value (in which case func.call is preferable). An error is signaled otherwise.
  • args should be an array/slice of Value, or a tuple of different types, each implementing IntoLisp.

Examples

#[defun]
fn listify_vec(vector: Vector) -> Result<Value> {
    let env = vector.0.env;
    let mut args = vec![];
    for i in 0..vector.size()? {
        args.push(vector.get(i)?)
    }
    env.call("list", &args)
}

Trait Implementations

impl Debug for Env[src]

impl Drop for Env[src]

Auto Trait Implementations

impl !RefUnwindSafe for Env

impl !Send for Env

impl !Sync for Env

impl Unpin for Env

impl UnwindSafe for Env

Blanket Implementations

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

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

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

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.