1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
use crate::args::AsRawV;
pub type Result<T> = core::result::Result<T, Error>;
#[derive(Clone, Copy, PartialEq, Eq, Debug)]
#[repr(transparent)]
pub struct Error(pub i32);
impl Error {
#[inline(always)]
pub const fn new(raw: i32) -> Self {
Self(raw)
}
}
#[inline(always)]
pub(crate) fn prepare_standard_result<T: AsRawV>(raw: crate::raw::V) -> Result<T> {
crate::raw::unpack_standard_result(raw)
.map(|raw| T::from_raw_result(raw))
.map_err(|raw| Error::new(raw))
}
#[inline(always)]
pub(crate) fn prepare_arg<T: AsRawV>(arg: T) -> crate::raw::V {
arg.to_raw_arg()
}