[][src]Struct glsp::Obj

pub struct Obj { /* fields omitted */ }

The obj primitive type.

Note that CallableOps is implemented for Root<Class>, so an Obj can be constructed from a Class using glsp::call.

Objects are always stored on the garbage-collected heap, so they're normally represented by the type Root<Obj>.

Implementations

impl Obj[src]

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

Kills the object.

Equivalent to (obj-kill! ob).

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

Returns true if the object has been killed.

Equivalent to (obj-killed? ob).

pub fn freeze(&self)[src]

Makes the object immutable.

Equivalent to (freeze! ob).

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

Returns true if the object has been frozen.

pub fn class(&self) -> Root<Class>

Notable traits for Root<GIter>

impl Iterator for Root<GIter> type Item = Result<Val, GError>;
[src]

Returns the object's class.

Equivalent to (class-of ob).

pub fn is(&self, class: &Root<Class>) -> bool[src]

Returns true if the object is an instance of the given class or mixin.

Equivalent to (is? ob cls).

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

Returns true if the given name is currently bound to a field, constant or property.

Equivalent to (has? ob key).

pub fn has_met<S>(&self, key: S) -> Result<bool, GError> where
    S: ToSym
[src]

Returns true if the given name is currently bound to a method.

Equivalent to (has-met? ob key).

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

Accesses the value of a field, constant or property.

Equivalent to [ob key].

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

Accesses the value of a field, constant or property, if it exists.

Equivalent to [ob (? key)].

pub fn access_giter(obj: &Root<Obj>, giter: &Root<GIter>) -> Root<GIter>

Notable traits for Root<GIter>

impl Iterator for Root<GIter> type Item = Result<Val, GError>;
[src]

Creates an indexing iterator for this collection.

Equivalent to [ob iter].

pub fn call<S, A, R>(&self, key: S, args: A) -> Result<R, GError> where
    R: FromVal,
    A: IntoCallArgs,
    S: ToSym
[src]

Invokes a method.

Note that the args are passed by reference. They should be a reference to (), a tuple, a slice, or a fixed-size array.

Equivalent to (call-met ob key ..args).

pub fn call_if_present<S, A, R>(
    &self,
    key: S,
    args: A
) -> Result<Option<R>, GError> where
    R: FromVal,
    A: IntoCallArgs,
    S: ToSym
[src]

Invokes a method, if it exists.

Note that the args are passed by reference. They should be a reference to (), a tuple, a slice, or a fixed-size array.

Equivalent to (call-met ob (? key) ..args).

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

Mutates the field or property bound to the given name.

Equivalent to (= [ob key] value).

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

Mutates the field or property bound to the given name, if any. Returns true if the field or property exists.

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

pub fn has_state<S>(&self, state_name: S) -> Result<bool, GError> where
    S: ToSym
[src]

Returns true if the object's class defines a state with the given name, even if it's not currently enabled.

Equivalent to (has-state? ob state-name).

pub fn is_enab<S>(&self, state_name: S) -> Result<bool, GError> where
    S: ToSym
[src]

Returns true if a state is currently enabled.

Equivalent to (enab? ob state-name).

pub fn enab<S, A>(&self, state_name: S, args: A) -> Result<(), GError> where
    A: Clone + IntoCallArgs,
    S: ToSym
[src]

Enables a state.

Equivalent to (enab! ob state-name).

pub fn disab<S>(&self, state_name: S) -> Result<(), GError> where
    S: ToSym
[src]

Disables a state.

Equivalent to (disab! ob state-name).

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

Equivalent to (eq? self other).

Note that, because this may invoke an op-eq? method, it can potentially fail.

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

Trait Implementations

impl Debug for Obj[src]

impl Display for Obj[src]

impl PartialEq<Root<Obj>> for Obj[src]

Auto Trait Implementations

impl !RefUnwindSafe for Obj[src]

impl !Send for Obj[src]

impl !Sync for Obj[src]

impl Unpin for Obj[src]

impl !UnwindSafe for Obj[src]

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> IntoElement<Slot> for T where
    T: IntoVal
[src]

impl<T> IntoVal for T where
    T: StaticMarker, 
[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.