pub struct JsCell<'js, T>where
T: JsClass<'js>,{ /* private fields */ }
Expand description
A cell type for Rust classes passed to JavaScript.
Implements RefCell
-like borrow checking.
Implementations§
source§impl<'js, T> JsCell<'js, T>where
T: JsClass<'js>,
impl<'js, T> JsCell<'js, T>where
T: JsClass<'js>,
sourcepub fn try_borrow<'a>(&'a self) -> Result<Borrow<'a, 'js, T>, BorrowError>
pub fn try_borrow<'a>(&'a self) -> Result<Borrow<'a, 'js, T>, BorrowError>
Try to borrow the contained value immutable.
sourcepub fn borrow_mut<'a>(&'a self) -> BorrowMut<'a, 'js, T>
pub fn borrow_mut<'a>(&'a self) -> BorrowMut<'a, 'js, T>
Borrow the contained value mutably.
§Panic
Panics if the value is already borrowed mutably or the class can’t be borrowed mutably.
sourcepub fn try_borrow_mut<'a>(
&'a self
) -> Result<BorrowMut<'a, 'js, T>, BorrowError>
pub fn try_borrow_mut<'a>( &'a self ) -> Result<BorrowMut<'a, 'js, T>, BorrowError>
Try to borrow the contained value mutably.
Auto Trait Implementations§
impl<'js, T> Freeze for JsCell<'js, T>
impl<'js, T> RefUnwindSafe for JsCell<'js, T>
impl<'js, T> Send for JsCell<'js, T>
impl<'js, T> Sync for JsCell<'js, T>
impl<'js, T> Unpin for JsCell<'js, T>
impl<'js, T> UnwindSafe for JsCell<'js, T>
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> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more