[−][src]Enum glsp_engine::Val
Any GameLisp value.
Many functions in this crate provide automatic conversions to and from Val
, using the
FromVal
and IntoVal
traits.
Variants
Int(i32)
Flo(f32)
Char(char)
Bool(bool)
Sym(Sym)
Implementations
impl Val
[src]
pub fn type_name(&self) -> &'static str
[src]
Returns the name of this value's primitive type, such as "nil"
or "fn"
.
pub fn a_type_name(&self) -> &'static str
[src]
Returns the name of this value's primitive type, prefixed with the indefinite article,
such as "an arr"
or "a fn"
.
match val { Val::Int(_) => (), _ => bail!("expected an int, received {}", val.a_type_name()) }
impl Val
[src]
pub fn is_int(&self) -> bool
[src]
pub fn unwrap_int(self) -> i32
[src]
pub fn is_flo(&self) -> bool
[src]
pub fn unwrap_flo(self) -> f32
[src]
pub fn is_char(&self) -> bool
[src]
pub fn unwrap_char(self) -> char
[src]
pub fn is_bool(&self) -> bool
[src]
pub fn unwrap_bool(self) -> bool
[src]
pub fn is_sym(&self) -> bool
[src]
pub fn unwrap_sym(self) -> Sym
[src]
pub fn is_arr(&self) -> bool
[src]
pub fn unwrap_arr(self) -> Root<Arr>ⓘ
[src]
pub fn is_str(&self) -> bool
[src]
pub fn unwrap_str(self) -> Root<Str>ⓘ
[src]
pub fn is_tab(&self) -> bool
[src]
pub fn unwrap_tab(self) -> Root<Tab>ⓘ
[src]
pub fn is_giter(&self) -> bool
[src]
pub fn unwrap_giter(self) -> Root<GIter>ⓘ
[src]
pub fn is_obj(&self) -> bool
[src]
pub fn unwrap_obj(self) -> Root<Obj>ⓘ
[src]
pub fn is_class(&self) -> bool
[src]
pub fn unwrap_class(self) -> Root<Class>ⓘ
[src]
pub fn is_gfn(&self) -> bool
[src]
pub fn unwrap_gfn(self) -> Root<GFn>ⓘ
[src]
pub fn is_coro(&self) -> bool
[src]
pub fn unwrap_coro(self) -> Root<Coro>ⓘ
[src]
pub fn is_rdata(&self) -> bool
[src]
pub fn unwrap_rdata(self) -> Root<RData>ⓘ
[src]
pub fn is_rfn(&self) -> bool
[src]
pub fn unwrap_rfn(self) -> Root<RFn>ⓘ
[src]
impl Val
[src]
pub fn is_nil(&self) -> bool
[src]
pub fn is_truthy(&self) -> bool
[src]
Returns true
if the value is anything other than #n
or #f
.
pub fn is_falsy(&self) -> bool
[src]
Returns true
if the value is #n
or #f
.
pub fn is_num(&self) -> bool
[src]
Returns true
if the value belongs to the num
abstract type (int
or flo
).
pub fn is_deque(&self) -> bool
[src]
Returns true
if the value belongs to the deque
abstract type (arr
or str
).
pub fn is_callable(&self) -> bool
[src]
Returns true
if the value belongs to the callable
abstract type (fn
, rfn
or class
).
pub fn is_expander(&self) -> bool
[src]
Returns true
if the value belongs to the expander
abstract type (fn
or rfn
).
pub fn is_iterable(&self) -> bool
[src]
Returns true
if the value belongs to the iterable
abstract type (arr
, str
, tab
,
iter
or coro
).
pub fn shallow_clone(&self) -> GResult<Val>
[src]
Creates a shallow copy of the value.
Equivalent to (clone val)
.
pub fn deep_clone(&self) -> GResult<Val>
[src]
Recursively copies the value and all of its contents.
Equivalent to (deep-clone val)
.
pub fn freeze(&self)
[src]
Makes the value immutable.
Equivalent to (freeze! val)
.
pub fn deep_freeze(&self)
[src]
Makes the value and all of its contents immutable.
Equivalent to (deep-freeze! val)
.
impl Val
[src]
pub fn num_eq(&self, other: &Val) -> Option<bool>
[src]
Equivalent to (== self other)
.
pub fn same(&self, other: &Val) -> bool
[src]
Equivalent to (same? self other)
.
pub fn keys_eqv(&self, other: &Val) -> bool
[src]
Equivalent to (keys-eqv? self other)
.
pub fn try_eq(&self, other: &Val) -> GResult<bool>
[src]
Equivalent to (eq? self other)
.
Note that, because this method may need to invoke an op-eq?
method when both of its
arguments are objects or RData
, it can potentially fail.
The same is true for PartialEq
and Eq
comparisons between values - for example, using
Rust's ==
operator. If those comparisons encounter a GameLisp error, they will panic.
impl Val
[src]
impl Val
[src]
pub fn is_representable(&self) -> bool
[src]
Returns true
if this value can be losslessly converted to text.
pub fn check_representability(&self) -> Result<(), &'static str>
[src]
Returns Ok
if this value can be losslessly converted to text.
Trait Implementations
impl Clone for Val
[src]
impl Debug for Val
[src]
impl Default for Val
[src]
impl Display for Val
[src]
impl Eq for Val
[src]
impl FromElement<char> for Val
[src]
pub fn from_element(item: &char) -> GResult<Self>
[src]
impl FromVal for Val
[src]
impl IntoElement<char> for Val
[src]
pub fn into_element(self) -> GResult<char>
[src]
impl IntoElement<char> for &Val
[src]
pub fn into_element(self) -> GResult<char>
[src]
impl IntoElement<char> for &mut Val
[src]
pub fn into_element(self) -> GResult<char>
[src]
impl IntoVal for Val
[src]
impl<'a> IntoVal for &'a Val
[src]
impl<'a> IntoVal for &'a mut Val
[src]
impl PartialEq<Val> for Val
[src]
pub fn eq(&self, other: &Val) -> bool
[src]
#[must_use]pub fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl PartialOrd<Val> for Val
[src]
pub fn partial_cmp(&self, other: &Val) -> Option<Ordering>
[src]
#[must_use]pub fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl Splay for Val
[src]
Auto Trait Implementations
impl !RefUnwindSafe for Val
[src]
impl !Send for Val
[src]
impl !Sync for Val
[src]
impl Unpin for Val
[src]
impl !UnwindSafe for Val
[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> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
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>,