Updated based on feedback
Added documentation over Unpack::SIZE
Cleaned up spelling mistakes
Cleaned up a bunch of trailing whitespace that was introduced somehow
@@ -153,7 +153,12 @@ impl TryFrom<&str> for WasiAPIName {
/// Unpack a sequence of `bytes` and return a `T`.
pub trait Unpack: Sized {
+ /// Size in bytes of the structure in the Wasm memory space. Note that this
+ /// may be different than the resulting type since it is in a different
+ /// memory space on a machine that likely has different pointer sizes.
const SIZE: u32;
+
+ /// Unpack the `T`
fn unpack(bytes: &[u8]) -> FileSystemResult<Self>;
}
@@ -386,7 +391,7 @@ const IOVECSLICES_SOO_COUNT: usize = 2;
/// This indirection is needed to hold the MemoryHandler::Slice type which
/// needs to be stored somewhere
///
-/// This may allocated, though most iovecs are fairly small. As an extra
+/// This may allocate, though most iovecs are fairly small. As an extra
/// optimization, if there are only 1 or 2 iovecs, these are stored directly
/// in the struct with no allocation. 1 iovec is the most common, though
/// 2 iovecs is used sometimes for things like appending newlines to stdout.
@@ -427,7 +432,7 @@ impl<'a, R> AsRef<[&'a [u8]]> for IoVecSlices<'a, R> {
/// This indirection is needed to hold the MemoryHandler::SliceMut type which
/// needs to be stored somewhere
///
-/// This may allocated, though most iovecs are fairly small. As an extra
+/// This may allocate, though most iovecs are fairly small. As an extra
/// optimization, if there are only 1 or 2 iovecs, these are stored directly
/// in the struct with no allocation. 1 iovec is the most common, though
/// 2 iovecs is used sometimes for things like appending newlines to stdout.
