[−][src]Struct glsp_engine::Tab
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
.
Tables are always stored on the garbage-collected heap, so they're normally represented by
the type Root<Tab>
.
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) -> GResult<Root<Tab>>
[src]
Recursively copies the table and all of its contents.
Equivalent to (deep-clone t)
.
pub fn try_eq(&self, other: &Tab) -> GResult<bool>
[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: IntoVal, V: FromVal>(&self, key: K) -> GResult<V>
[src]
Indexes the table.
Equivalent to [t key]
.
pub fn get_if_present<K: IntoVal, V: FromVal>(
&self,
key: K
) -> GResult<Option<V>>
[src]
&self,
key: K
) -> GResult<Option<V>>
Indexes the table, if the given key is present.
Equivalent to [t (? key)]
.
pub fn set<K, V>(&self, key: K, value: V) -> GResult<()> where
K: IntoVal,
V: IntoVal,
[src]
K: IntoVal,
V: IntoVal,
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) -> GResult<bool> where
K: IntoVal,
V: IntoVal,
[src]
K: IntoVal,
V: IntoVal,
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: IntoVal>(&self, key: K) -> GResult<bool>
[src]
Returns true
if the given key is present in the table.
Equivalent to (has? t key)
.
pub fn del<K: IntoVal>(&self, key: K) -> GResult<()>
[src]
Removes a key/value pair from the table, without returning it.
Equivalent to (del! t key)
.
pub fn del_if_present<K: IntoVal>(&self, key: K) -> GResult<bool>
[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: IntoVal, V: FromVal>(&self, key: K) -> GResult<V>
[src]
Removes a key/value pair from the table and returns it.
Equivalent to (remove! t key)
.
pub fn remove_if_present<K: IntoVal, V: FromVal>(
&self,
key: K
) -> GResult<Option<V>>
[src]
&self,
key: K
) -> GResult<Option<V>>
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) -> GResult<()>
[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) -> GResult<()>
[src]
Shrinks the capacity of the table as much as possible.
Equivalent to HashMap::shrink_to_fit
.
pub fn clear(&self) -> GResult<()>
[src]
Removes all of the table's elements.
Equivalent to HashMap::clear
.
pub fn entries<'a>(&'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) -> GResult<()> where
T: IntoIterator<Item = (K, V)>,
K: IntoVal,
V: IntoVal,
[src]
T: IntoIterator<Item = (K, V)>,
K: IntoVal,
V: IntoVal,
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 is_representable(&self) -> bool
[src]
Returns true
if this table can be losslessly converted to text.
pub fn check_representability(&self) -> Result<(), &'static str>
[src]
Returns Ok
if this table can be losslessly converted to text.
Trait Implementations
impl Debug for Tab
[src]
impl Display for Tab
[src]
impl Eq for Tab
[src]
impl PartialEq<Tab> for Tab
[src]
Auto Trait Implementations
impl !RefUnwindSafe for Tab
[src]
impl !Send for Tab
[src]
impl !Sync for Tab
[src]
impl Unpin for Tab
[src]
impl !UnwindSafe for Tab
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Erased for T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,