Trait neon::types::buffer::TypedArray [−][src]
pub trait TypedArray: Sealed {
type Item;
fn as_slice<'a: 'b, 'b, C>(&'b self, cx: &'b C) -> &'b [Self::Item]
where
C: Context<'a>;
fn as_mut_slice<'a: 'b, 'b, C>(
&'b mut self,
cx: &'b mut C
) -> &'b mut [Self::Item]
where
C: Context<'a>;
fn try_borrow<'a: 'b, 'b, C>(
&self,
lock: &'b Lock<'b, C>
) -> Result<Ref<'b, Self::Item>, BorrowError>
where
C: Context<'a>;
fn try_borrow_mut<'a: 'b, 'b, C>(
&mut self,
lock: &'b Lock<'b, C>
) -> Result<RefMut<'b, Self::Item>, BorrowError>
where
C: Context<'a>;
}
Expand description
A trait for borrowing binary data from JavaScript values
Provides both statically and dynamically checked borrowing. Mutable borrows are guaranteed not to overlap with other borrows.
Associated Types
Required methods
Statically checked immutable borrow of binary data.
This may not be used if a mutable borrow is in scope. For the dynamically
checked variant see TypedArray::try_borrow
.
Statically checked mutable borrow of binary data.
This may not be used if any other borrow is in scope. For the dynamically
checked variant see TypedArray::try_borrow_mut
.
fn try_borrow<'a: 'b, 'b, C>(
&self,
lock: &'b Lock<'b, C>
) -> Result<Ref<'b, Self::Item>, BorrowError> where
C: Context<'a>,
fn try_borrow<'a: 'b, 'b, C>(
&self,
lock: &'b Lock<'b, C>
) -> Result<Ref<'b, Self::Item>, BorrowError> where
C: Context<'a>,
Dynamically checked immutable borrow of binary data, returning an error if the the borrow would overlap with a mutable borrow.
The borrow lasts until Ref
exits scope.
This is the dynamically checked version of TypedArray::as_slice
.
fn try_borrow_mut<'a: 'b, 'b, C>(
&mut self,
lock: &'b Lock<'b, C>
) -> Result<RefMut<'b, Self::Item>, BorrowError> where
C: Context<'a>,
fn try_borrow_mut<'a: 'b, 'b, C>(
&mut self,
lock: &'b Lock<'b, C>
) -> Result<RefMut<'b, Self::Item>, BorrowError> where
C: Context<'a>,
Dynamically checked mutable borrow of binary data, returning an error if the the borrow would overlap with an active borrow.
The borrow lasts until RefMut
exits scope.
This is the dynamically checked version of TypedArray::as_mut_slice
.