pub struct ResourceBorrow { /* private fields */ }Expand description
Represents a resource that is borrowed by the host. If this borrow originated from a host-owned resource,
then it must be manually released via ResourceBorrow::drop, or the owned resource will be considered
borrowed indefinitely.
Implementations§
Source§impl ResourceBorrow
impl ResourceBorrow
Sourcepub fn rep<'a, T: 'static + Send + Sync, S, E: WasmEngine>(
&self,
ctx: &'a StoreContext<'_, S, E>,
) -> Result<&'a T>
pub fn rep<'a, T: 'static + Send + Sync, S, E: WasmEngine>( &self, ctx: &'a StoreContext<'_, S, E>, ) -> Result<&'a T>
Gets the internal representation of this resource. Fails if this is not a host resource, or if the resource was already dropped.
Sourcepub fn rep_mut<'a, T: 'static + Send + Sync, S, E: WasmEngine>(
&self,
ctx: &'a mut StoreContextMut<'_, S, E>,
) -> Result<&'a mut T>
pub fn rep_mut<'a, T: 'static + Send + Sync, S, E: WasmEngine>( &self, ctx: &'a mut StoreContextMut<'_, S, E>, ) -> Result<&'a mut T>
Gets the internal mut representation of this resource. Fails if this is not a host resource, or if the resource was already dropped.
Sourcepub fn ty(&self) -> ResourceType
pub fn ty(&self) -> ResourceType
Gets the type of this value.
Sourcepub fn drop(&self, ctx: impl AsContextMut) -> Result<()>
pub fn drop(&self, ctx: impl AsContextMut) -> Result<()>
Drops this borrow. Fails if this was not a manual borrow of a host resource.
Trait Implementations§
Source§impl Clone for ResourceBorrow
impl Clone for ResourceBorrow
Source§fn clone(&self) -> ResourceBorrow
fn clone(&self) -> ResourceBorrow
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ResourceBorrow
impl Debug for ResourceBorrow
Source§impl PartialEq for ResourceBorrow
impl PartialEq for ResourceBorrow
Auto Trait Implementations§
impl Freeze for ResourceBorrow
impl !RefUnwindSafe for ResourceBorrow
impl Send for ResourceBorrow
impl Sync for ResourceBorrow
impl Unpin for ResourceBorrow
impl !UnwindSafe for ResourceBorrow
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