Struct wai_bindgen_wasmer::region::BorrowChecker
source · pub struct BorrowChecker<'a> {
shared_borrows: HashSet<Region>,
mut_borrows: HashSet<Region>,
_marker: PhantomData<&'a mut [u8]>,
ptr: *mut u8,
len: usize,
}
Fields§
Maps from handle to region borrowed. A HashMap is probably not ideal
for this but it works. It would be more efficient if we could
check is_borrowed
without an O(n) iteration, by organizing borrows
by an ordering of Region.
mut_borrows: HashSet<Region>
§_marker: PhantomData<&'a mut [u8]>
§ptr: *mut u8
§len: usize
Implementations§
source§impl<'a> BorrowChecker<'a>
impl<'a> BorrowChecker<'a>
pub fn new(data: &'a mut [u8]) -> BorrowChecker<'a>
pub fn slice<T: AllBytesValid>( &mut self, ptr: i32, len: i32, ) -> Result<&'a [T], RuntimeError>
pub fn slice_mut<T: AllBytesValid>( &mut self, ptr: i32, len: i32, ) -> Result<&'a mut [T], RuntimeError>
fn get_slice<T: AllBytesValid>( &self, ptr: i32, len: i32, ) -> Result<(&[T], Region), RuntimeError>
fn get_slice_mut<T>( &mut self, ptr: i32, len: i32, ) -> Result<(&mut [T], Region), RuntimeError>
fn region<T>(&self, ptr: i32, len: i32) -> Result<Region, RuntimeError>
pub fn slice_str(&mut self, ptr: i32, len: i32) -> Result<&'a str, RuntimeError>
fn validate_contains(&self, region: &Region) -> Result<(), RuntimeError>
fn is_mut_borrowed(&self, r: Region) -> bool
pub fn raw(&self) -> *mut [u8]
Trait Implementations§
impl Send for BorrowChecker<'_>
impl Sync for BorrowChecker<'_>
Auto Trait Implementations§
impl<'a> Freeze for BorrowChecker<'a>
impl<'a> RefUnwindSafe for BorrowChecker<'a>
impl<'a> Unpin for BorrowChecker<'a>
impl<'a> !UnwindSafe for BorrowChecker<'a>
Blanket Implementations§
§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Returns the layout of the type.
§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2where
T: SharedNiching<N1, N2>,
N1: Niching<T>,
N2: Niching<T>,
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2where
T: SharedNiching<N1, N2>,
N1: Niching<T>,
N2: Niching<T>,
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> Pointee for T
impl<T> Pointee for T
§impl<T> Upcastable for T
impl<T> Upcastable for T
§fn upcast_any_ref(&self) -> &(dyn Any + 'static)
fn upcast_any_ref(&self) -> &(dyn Any + 'static)
upcast ref
§fn upcast_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn upcast_any_mut(&mut self) -> &mut (dyn Any + 'static)
upcast mut ref
§fn upcast_any_box(self: Box<T>) -> Box<dyn Any>
fn upcast_any_box(self: Box<T>) -> Box<dyn Any>
upcast boxed dyn