Skip to main content

GetErrno

Trait GetErrno 

Source
pub trait GetErrno: Copy {
    // Required method
    fn get_errno(self) -> SystemErrno;
}
Expand description

Zig’s getErrno(rc: anytype) switches on @TypeOf(rc) to pick the errno extraction strategy. Rust has no type-switch, so we model it as a trait with per-type impls — call as rc.get_errno() or get_errno(rc).

The trait declaration is target-independent; each per-OS module supplies its own impl GetErrno for {i32,u32,isize,usize,...} (Linux decodes raw-syscall -errno from usize, Darwin/FreeBSD read thread-local errno on -1, Windows ignores rc and reads GetLastError()/WSAGetLastError()).

Required Methods§

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl GetErrno for i32

Source§

impl GetErrno for i64

Source§

impl GetErrno for isize

Source§

impl GetErrno for u32

Source§

impl GetErrno for usize

Implementors§