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

Function try_decode_error

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

Source from the content-addressed store, hash-verified

238#[cfg(any(feature = "event", feature = "runtime", feature = "system"))]
239#[inline]
240pub(in crate::backend) unsafe fn try_decode_error<Num: RetNumber>(raw: RetReg<Num>) -> io::Errno {
241 debug_assert!(raw.is_in_range(-4095..0));
242
243 // Tell the optimizer that we know the value is in the error range.
244 // This helps it avoid unnecessary integer conversions.
245 #[cfg(core_intrinsics)]
246 {
247 core::intrinsics::assume(raw.is_in_range(-4095..0));
248 }
249
250 Errno(raw.decode_error_code())
251}
252
253/// Return the contained `usize` value.
254#[cfg(not(debug_assertions))]

Callers 1

ret_errorFunction · 0.85

Calls 3

is_in_rangeMethod · 0.80
decode_error_codeMethod · 0.80
ErrnoClass · 0.70

Tested by

no test coverage detected