MCPcopy Create free account
hub / github.com/bytecodealliance/rustix / try_decode_usize

Function try_decode_usize

src/backend/linux_raw/io/errno.rs:132–140  ·  view source on GitHub ↗
(raw: RetReg<Num>)

Source from the content-addressed store, hash-verified

130/// success.
131#[inline]
132pub(in crate::backend) fn try_decode_usize<Num: RetNumber>(raw: RetReg<Num>) -> io::Result<usize> {
133 if raw.is_in_range(-4095..0) {
134 // SAFETY: `raw` must be in `-4095..0`, and we just checked that raw is
135 // in that range.
136 return Err(unsafe { Errno(raw.decode_error_code()) });
137 }
138
139 Ok(raw.decode_usize())
140}
141
142/// Check for an error from the result of a syscall which encodes a
143/// `*mut c_void` on success.

Callers 2

ret_usizeFunction · 0.85
ret_usize_infallibleFunction · 0.85

Calls 4

is_in_rangeMethod · 0.80
decode_error_codeMethod · 0.80
decode_usizeMethod · 0.80
ErrnoClass · 0.70

Tested by

no test coverage detected