MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / new_rounded_up_u64

Method new_rounded_up_u64

crates/wasmtime/src/runtime/vm/byte_count.rs:61–66  ·  view source on GitHub ↗

Creates a new `HostAlignedByteCount` from a `u64`, rounding up to the nearest page. Returns an error if the `u64` overflows `usize`, or if `bytes + page_size - 1` overflows.

(bytes: u64)

Source from the content-addressed store, hash-verified

59 /// Returns an error if the `u64` overflows `usize`, or if `bytes +
60 /// page_size - 1` overflows.
61 pub fn new_rounded_up_u64(bytes: u64) -> Result<Self, ByteCountOutOfBounds> {
62 let bytes = bytes
63 .try_into()
64 .map_err(|_| ByteCountOutOfBounds(ByteCountOutOfBoundsKind::ConvertU64))?;
65 Self::new_rounded_up(bytes)
66 }
67
68 /// Returns the host page size.
69 pub fn host_page_size() -> HostAlignedByteCount {

Callers

nothing calls this directly

Calls 2

try_intoMethod · 0.45

Tested by

no test coverage detected