Struct koto_runtime::KObject
source · pub struct KObject { /* private fields */ }
Expand description
A wrapper for KotoObjects used in the Koto runtime
Implementations§
source§impl KObject
impl KObject
sourcepub fn is_a<T: KotoObject>(&self) -> bool
pub fn is_a<T: KotoObject>(&self) -> bool
Checks if the object is of the given type
sourcepub fn try_borrow(&self) -> Result<Borrow<'_, dyn KotoObject>>
pub fn try_borrow(&self) -> Result<Borrow<'_, dyn KotoObject>>
Attempts to borrow the underlying object immutably
sourcepub fn try_borrow_mut(&self) -> Result<BorrowMut<'_, dyn KotoObject>>
pub fn try_borrow_mut(&self) -> Result<BorrowMut<'_, dyn KotoObject>>
Attempts to borrow the underlying object mutably
sourcepub fn cast<T: KotoObject>(&self) -> Result<Borrow<'_, T>>
pub fn cast<T: KotoObject>(&self) -> Result<Borrow<'_, T>>
Attempts to immutably borrow and cast the underlying object to the specified type
sourcepub fn cast_mut<T: KotoObject>(&self) -> Result<BorrowMut<'_, T>>
pub fn cast_mut<T: KotoObject>(&self) -> Result<BorrowMut<'_, T>>
Attempts to mutably borrow and cast the underlying object to the specified type
sourcepub fn is_same_instance(&self, other: &Self) -> bool
pub fn is_same_instance(&self, other: &Self) -> bool
Returns true if the provided object occupies the same memory address
Trait Implementations§
Auto Trait Implementations§
impl Freeze for KObject
impl !RefUnwindSafe for KObject
impl Send for KObject
impl Sync for KObject
impl Unpin for KObject
impl !UnwindSafe for KObject
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.