Skip to content

Commit b588ce0

Browse files
committed
Add some more docs
1 parent 72d8e92 commit b588ce0

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

packages/std/src/memory.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
11
use alloc::vec::Vec;
22
use core::{any::TypeId, marker::PhantomData, mem, ops::Deref, slice};
33

4+
/// This trait is used to indicate whether a region is borrowed or owned
45
pub trait Ownership: 'static {}
56

67
impl Ownership for Borrowed {}
78

89
impl Ownership for Owned {}
910

10-
pub struct Owned;
11-
11+
/// This type is used to indicate that the region is borrowed and must not be deallocated
1212
pub struct Borrowed;
1313

14+
/// This type is used to indicate that the region is owned by the region and must be deallocated
15+
pub struct Owned;
16+
1417
/// Describes some data allocated in Wasm's linear memory.
1518
/// A pointer to an instance of this can be returned over FFI boundaries.
1619
///
@@ -67,6 +70,7 @@ impl Region<Owned> {
6770
region
6871
}
6972

73+
/// Transform the region into a vector
7074
pub fn into_vec(self) -> Vec<u8> {
7175
let vector = unsafe {
7276
Vec::from_raw_parts(

0 commit comments

Comments
 (0)