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

Function try_decode_c_uint

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

Source from the content-addressed store, hash-verified

115/// `c::c_uint` on success.
116#[inline]
117pub(in crate::backend) fn try_decode_c_uint<Num: RetNumber>(
118 raw: RetReg<Num>,
119) -> io::Result<c::c_uint> {
120 if raw.is_in_range(-4095..0) {
121 // SAFETY: `raw` must be in `-4095..0`, and we just checked that raw is
122 // in that range.
123 return Err(unsafe { Errno(raw.decode_error_code()) });
124 }
125
126 Ok(raw.decode_c_uint())
127}
128
129/// Check for an error from the result of a syscall which encodes a `usize` on
130/// success.

Callers 2

ret_c_uintFunction · 0.85
ret_c_uint_infallibleFunction · 0.85

Calls 4

is_in_rangeMethod · 0.80
decode_error_codeMethod · 0.80
decode_c_uintMethod · 0.80
ErrnoClass · 0.70

Tested by

no test coverage detected