pub struct JsCell<'js, 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: JsClass<'js>> JsCell<'js, T>
impl<'js, T: JsClass<'js>> JsCell<'js, T>
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