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]
unsafe fn new(raw: emacs_value, env: &'e Env) -> Self
[src]
fn into_rust<T: FromLisp>(self) -> Result<T>
[src]
Converts this value into a Rust value of the given type.
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.
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]
impl<'e> Debug for Value<'e>
[src]
impl<'e> Clone for Value<'e>
[src]
fn clone(&self) -> Value<'e>
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more