Struct emacs::Vector

source ·
pub struct Vector<'e> { /* private fields */ }
Expand description

A type that represents Lisp vectors. This is a wrapper around Value that provides vector-specific methods.

Arguments to #[defun] having this type will be type-checked. If you want to omit, or delay this type checking, use Value instead.

use emacs::{defun, Value, Vector, Result};

#[defun]
fn must_pass_vector(vector: Vector) -> Result<Vector> {
    Ok(vector)
}

#[defun]
fn no_type_check(value: Value) -> Result<Vector> {
    Ok(Vector::from_value_unchecked(value, 0))
}

Implementations§

source§

impl<'e> Vector<'e>

source

pub fn get<T: FromLisp<'e>>(&self, i: usize) -> Result<T>

source

pub fn set<T: IntoLisp<'e>>(&self, i: usize, value: T) -> Result<()>

source

pub fn len(&self) -> usize

source

pub fn value(&self) -> Value<'e>

Trait Implementations§

source§

impl<'e> Clone for Vector<'e>

source§

fn clone(&self) -> Vector<'e>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<'e> Debug for Vector<'e>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'e> FromLisp<'e> for Vector<'e>

source§

fn from_lisp(value: Value<'e>) -> Result<Vector<'e>>

source§

impl<'e> IntoIterator for Vector<'e>

§

type Item = Value<'e>

The type of the elements being iterated over.
§

type IntoIter = IntoIter<'e>

Which kind of iterator are we turning this into?
source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
source§

impl<'e> IntoLisp<'e> for Vector<'e>

source§

fn into_lisp(self, _: &'e Env) -> Result<Value<'_>>

source§

impl<'e> Copy for Vector<'e>

Auto Trait Implementations§

§

impl<'e> Freeze for Vector<'e>

§

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

§

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

§

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

§

impl<'e> Unpin for Vector<'e>

§

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

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

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

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

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.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.