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)
| 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 { |
nothing calls this directly
no test coverage detected