[][src]Struct glsp::Tab

pub struct Tab { /* fields omitted */ }

The tab primitive type.

New tables can be constructed using the tab! macro or various toplevel functions, such as glsp::tab and glsp::tab_from_iter.

Implementations

impl Tab[src]

pub fn shallow_clone(&self) -> Root<Tab>[src]

Creates a shallow copy of the table.

Equivalent to (clone t).

pub fn deep_clone(&self) -> Result<Root<Tab>, GError>[src]

Recursively copies the table and all of its contents.

Equivalent to (deep-clone t).

pub fn try_eq(&self, other: &Tab) -> Result<bool, GError>[src]

Equivalent to (eq? self other).

Note that, because this method may need to invoke an op-eq? method when one of the table's values is an object or an RData, it can potentially fail.

The same is true for PartialEq comparisons between tables using Rust's == operator. In that case, if an error occurs, the operator will panic.

pub fn get<K, V>(&self, key: K) -> Result<V, GError> where
    K: ToVal,
    V: FromVal
[src]

Indexes the table.

Equivalent to [t key].

pub fn get_if_present<K, V>(&self, key: K) -> Result<Option<V>, GError> where
    K: ToVal,
    V: FromVal
[src]

Indexes the table, if the given key is present.

Equivalent to [t (? key)].

pub fn set<K, V>(&self, key: K, value: V) -> Result<(), GError> where
    K: ToVal,
    V: ToVal
[src]

Mutates the value stored at the given key, or inserts a new key/value pair.

Equivalent to (= [t key] value).

pub fn set_if_present<K, V>(&self, key: K, value: V) -> Result<bool, GError> where
    K: ToVal,
    V: ToVal
[src]

Mutates the value stored at the given key, if the key is already present in the table.

Returns true if the key was present.

Equivalent to (= [t (? key)] value).

pub fn has<K>(&self, key: K) -> Result<bool, GError> where
    K: ToVal
[src]

Returns true if the given key is present in the table.

Equivalent to (has? t key).

pub fn del<K>(&self, key: K) -> Result<(), GError> where
    K: ToVal
[src]

Removes a key/value pair from the table, without returning it.

Equivalent to (del! t key).

pub fn del_if_present<K>(&self, key: K) -> Result<bool, GError> where
    K: ToVal
[src]

Removes a key/value pair from the table if it's present, without returning it.

Returns true if the key was present.

Equivalent to (del! t (? key)).

pub fn remove<K, V>(&self, key: K) -> Result<V, GError> where
    K: ToVal,
    V: FromVal
[src]

Removes a key/value pair from the table and returns it.

Equivalent to (remove! t key).

pub fn remove_if_present<K, V>(&self, key: K) -> Result<Option<V>, GError> where
    K: ToVal,
    V: FromVal
[src]

Removes a key/value pair from the table and returns it, if it's present.

Equivalent to (remove! t (? key)).

pub fn len(&self) -> usize[src]

Returns the table's length.

Equivalent to (len t).

pub fn capacity(&self) -> usize[src]

Returns the table's storage capacity.

Equivalent to HashMap::capacity.

pub fn reserve(&self, additional: usize) -> Result<(), GError>[src]

Reserves enough space for at least additional elements to be added to the table.

Equivalent to HashMap::reserve.

pub fn shrink_to_fit(&self) -> Result<(), GError>[src]

Shrinks the capacity of the table as much as possible.

Equivalent to HashMap::shrink_to_fit.

pub fn clear(&self) -> Result<(), GError>[src]

Removes all of the table's elements.

Equivalent to HashMap::clear.

pub fn entries(&'a self) -> TabEntries<'a>[src]

Returns an adapter which can be used to construct iterators over the table's contents.

pub fn gkeys(&self) -> Root<GIter>[src]

Returns a Root<GIter> which iterates over the table's keys.

Equivalent to (keys t).

pub fn gvalues(&self) -> Root<GIter>[src]

Returns a Root<GIter> which iterates over the table's values.

Equivalent to (values t).

pub fn extend<T, K, V>(&mut self, iter_source: T) -> Result<(), GError> where
    K: ToVal,
    T: IntoIterator<Item = (K, V)>,
    V: ToVal
[src]

Inserts the contents of an iterator as table entries.

Existing entries will be silently overwritten.

pub fn freeze(&self)[src]

Makes the table immutable.

Equivalent to (freeze! t).

pub fn deep_freeze(&self)[src]

Makes the table and all of its contents immutable.

Equivalent to (deep-freeze! t).

pub fn is_frozen(&self) -> bool[src]

Returns true if the table has been frozen.

pub fn is_deep_frozen(&self) -> bool[src]

Returns true if the table and all of its contents have been frozen.

pub fn can_mutate(&self) -> bool[src]

Returns true if it's possible to mutate the table without triggering an error.

This method will currently return false if the table has been frozen, or if it's currently being iterated from Rust.

impl Tab[src]

pub fn check_representability(&self) -> Result<(), &'static str>[src]

Returns Ok if this table can be losslessly converted to text.

pub fn check_serializability(&self) -> Result<(), &'static str>[src]

Returns Ok if this table can be serialized and deserialized using Serde.

Trait Implementations

impl Debug for Tab[src]

impl Display for Tab[src]

impl<'a, 'r> MakeArg<'a> for &'r Tab where
    'a: 'r, 
[src]

impl PartialEq<Tab> for Tab[src]

impl Serialize for Tab[src]

Auto Trait Implementations

impl !GSend for Tab

impl GStore for Tab

impl !RefUnwindSafe for Tab

impl !Send for Tab

impl !Sync for Tab

impl Unpin for Tab

impl !UnwindSafe for Tab

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> Erased for T

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

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

impl<T> ToString for T where
    T: Display + ?Sized
[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.