[−][src]Struct glsp::Class
The class
primitive type.
Note that CallableOps
is implemented for Root<Class>
, so an
Obj
can be constructed from a Class
using
glsp::call
.
Classes are always stored on the garbage-collected heap, so they're normally represented by
the type Root<Class>
.
Implementations
impl Class
[src]
pub fn get<S, V>(&self, key: S) -> Result<V, GError> where
V: FromVal,
S: ToSym,
[src]
V: FromVal,
S: ToSym,
Accesses the value of a constant.
Equivalent to [cls key]
.
pub fn get_if_present<S, V>(&self, key: S) -> Result<Option<V>, GError> where
V: FromVal,
S: ToSym,
[src]
V: FromVal,
S: ToSym,
Accesses the value of a constant if it's defined.
Equivalent to [cls (? key)]
.
pub fn call<S, A, R>(&self, key: S, args: A) -> Result<R, GError> where
R: FromVal,
A: IntoCallArgs,
S: ToSym,
[src]
R: FromVal,
A: IntoCallArgs,
S: ToSym,
Invokes a callable value stored in a constant.
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 key cls ..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]
&self,
key: S,
args: A
) -> Result<Option<R>, GError> where
R: FromVal,
A: IntoCallArgs,
S: ToSym,
If a constant with the given name is defined, and if it stores a callable value,
invokes it as a function and returns its result. Otherwise, returns None
.
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 (? key) cls ..args)
.
pub fn has_met<S>(&self, key: S) -> Result<bool, GError> where
S: ToSym,
[src]
S: ToSym,
Returns true
if the given name is bound to a constant with a callable value.
Equivalent to (has-met? cls key)
.
pub fn access_giter(class: &Root<Class>, giter: &Root<GIter>) -> Root<GIter>ⓘ
[src]
Creates an indexing iterator for this collection.
Equivalent to [cls iter]
.
pub fn has<S>(&self, key: S) -> Result<bool, GError> where
S: ToSym,
[src]
S: ToSym,
Returns true
if the given name is bound to a constant.
Equivalent to (has? cls key)
.
pub fn name(&self) -> Option<Sym>
[src]
Returns the name of the class, if any.
Equivalent to (class-name cls)
.
pub fn has_state<S>(&self, state_name: S) -> Result<bool, GError> where
S: ToSym,
[src]
S: ToSym,
Returns true
if the class defines a state with the given name.
Equivalent to (has-state? cls state-name)
.
pub fn has_mixin(&self, mixin: &Root<Class>) -> bool
[src]
Returns true
if the class incorporated the given class as a mixin.
Equivalent to (class-has-mixin? cls mixin)
.
pub fn is_mixin(&self) -> bool
[src]
Returns true
if the class is a mixin.
Equivalent to (mixin? cls)
.
pub fn mixins(&self) -> Root<Arr>ⓘ
[src]
Returns all of the class' mixins, as an Arr
.
Equivalent to (class-mixins cls)
.
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Class
[src]
impl !Send for Class
[src]
impl !Sync for Class
[src]
impl Unpin for Class
[src]
impl !UnwindSafe for Class
[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
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> IntoElement<Slot> for T where
T: IntoVal,
[src]
T: IntoVal,
pub fn into_element(self) -> Result<Slot, GError>
[src]
impl<T> IntoVal for T where
T: StaticMarker,
[src]
T: StaticMarker,
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>,