[][src]Struct emacs::GlobalRef

#[repr(transparent)]
pub struct GlobalRef { /* fields omitted */ }

A "global reference" that can live outside the scope of an Env. This is useful for sharing an otherwise short-lived Lisp Value across multiple invocations of Rust functions defined with defun. Examples include efficient access to interned symbols or Lisp functions, and Rust-based multi-threading.

Implementation

Cloning this struct requires an Env, so it doesn't implement Clone.

free_global_ref requires an Env. Therefore, to avoid leaking the underlying Value, free should be used to free a global reference, instead of drop. For the use case of accessing interned symbols and Lisp functions, this is a non-issue, as the values are supposed to be "static" anyway.

Methods

impl GlobalRef[src]

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

Calls this reference's 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.

impl GlobalRef[src]

pub fn new(value: Value) -> Self[src]

Creates a new global reference for the given Value.

pub fn free(self, env: &Env) -> Result<()>[src]

Frees this global reference.

pub fn bind<'e, 'g: 'e>(&'g self, env: &'e Env) -> Value<'e>[src]

Returns the underlying Value, scoping its lifetime to the given Env.

pub fn clone(&self, env: &Env) -> Self[src]

Returns a copy of this global reference.

Trait Implementations

impl Debug for GlobalRef[src]

impl<'e> FromLisp<'e> for GlobalRef[src]

impl<'e> IntoLisp<'e> for &'e GlobalRef[src]

impl Send for GlobalRef[src]

impl Sync for GlobalRef[src]

Auto Trait Implementations

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.