MCPcopy Index your code
hub / github.com/RustPython/RustPython / cvt

Function cvt

crates/common/src/crt_fd.rs:40–47  ·  view source on GitHub ↗
(ret: I)

Source from the content-addressed store, hash-verified

38
39#[inline]
40fn cvt<I: num_traits::PrimInt>(ret: I) -> io::Result<I> {
41 if ret < I::zero() {
42 // CRT functions set errno, not GetLastError(), so use errno_io_error
43 Err(crate::os::errno_io_error())
44 } else {
45 Ok(ret)
46 }
47}
48
49fn cvt_fd(ret: Raw) -> io::Result<Owned> {
50 cvt(ret).map(|fd| unsafe { Owned::from_raw(fd) })

Callers 7

check_builtinFunction · 0.85
cvt_fdFunction · 0.85
fsyncFunction · 0.85
_closeFunction · 0.85
ftruncateFunction · 0.85
_writeFunction · 0.85
_readFunction · 0.85

Calls 2

errno_io_errorFunction · 0.85
ErrClass · 0.50

Tested by

no test coverage detected