core/io/error/os_functions.rs
1use super::{ErrorKind, OsFunctions, RawOsError};
2use crate::fmt;
3
4/// # Safety
5///
6/// The provided reference must point to data that is entirely constant; it must
7/// not be created during runtime.
8#[inline]
9pub(super) unsafe fn set_functions(_f: &'static OsFunctions) {
10 // FIXME: externally implementable items may allow for weak linkage, allowing
11 // these methods to be overridden even when atomic pointers are not supported.
12}
13
14#[inline]
15pub(super) fn format_os_error(errno: RawOsError, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
16 let f = OsFunctions::DEFAULT;
17 (f.format_os_error)(errno, fmt)
18}
19
20#[inline]
21pub(super) fn decode_error_kind(errno: RawOsError) -> ErrorKind {
22 let f = OsFunctions::DEFAULT;
23 (f.decode_error_kind)(errno)
24}
25
26#[inline]
27pub(super) fn is_interrupted(errno: RawOsError) -> bool {
28 let f = OsFunctions::DEFAULT;
29 (f.is_interrupted)(errno)
30}