Struct emacs::Value [] [src]

pub struct Value<'e> { /* 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.

Implementations

We don't need a custom Clone implementation that does ref counting. TODO: Explain why (e.g. GC still keeps a ref during value's lifetime (does it?), get_mut() is always unsafe...)

Methods

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

[src]

Constructs a new Value

Safety

The raw value must come from the given Env.

[src]

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

[src]

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

Safety

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 cloned this value.
  • Rust code later in the call chain may receive a clone 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.

Trait Implementations

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

[src]

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

[src]

Formats the value using the given formatter.

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

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

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