Struct oasis_contract_sdk::memory::HostRegion
source · #[repr(C)]pub struct HostRegion {
pub offset: u32,
pub length: u32,
}
Expand description
A region of memory managed on behalf of the host.
The host is responsible for deallocating the region by calling deallocate
.
Fields§
§offset: u32
§length: u32
Implementations§
source§impl HostRegion
impl HostRegion
sourcepub fn from_arg((offset, length): (u32, u32)) -> Self
pub fn from_arg((offset, length): (u32, u32)) -> Self
Creates a new host region from arguments.
This does not yet transfer memory ownership from the host.
sourcepub fn from_args(offset: u32, length: u32) -> Self
pub fn from_args(offset: u32, length: u32) -> Self
Creates a new host region from arguments.
This does not yet transfer memory ownership from the host.
sourcepub fn from_vec(data: Vec<u8>) -> Self
pub fn from_vec(data: Vec<u8>) -> Self
Transfers ownership of memory to the host by constructing a host region.
sourcepub fn into_vec(self) -> Vec<u8> ⓘ
pub fn into_vec(self) -> Vec<u8> ⓘ
Transfers ownership of memory from the host and returns the vector.
§Safety
This is safe as long as the region was constructed from valid arguments.
sourcepub unsafe fn deref(arg: *const HostRegion) -> Self
pub unsafe fn deref(arg: *const HostRegion) -> Self
Returns a new region by dereferencing a pointer to the region.
This does not yet transfer memory ownership from the host.
§Safety
This is safe as long as the pointer is a valid pointer to the region struct.
Auto Trait Implementations§
impl Freeze for HostRegion
impl RefUnwindSafe for HostRegion
impl Send for HostRegion
impl Sync for HostRegion
impl Unpin for HostRegion
impl UnwindSafe for HostRegion
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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