userspace/target/
result.rs

1pub mod ok {
2    ample::result!(
3        Ok;
4        "Human Ok";
5        usize;
6        [
7            [1; TARGET_DEFAULT_OK; Default; usize; "ZE"; "Entry to ze"],
8            [2; TARGET_INFO_OK; Info; usize; "ZE"; "Entry to ze"],
9            [3; TARGET_OS_OK; Os; crate::target::os::Ok; "ZE"; "Entry to ze"],
10            [4; TARGET_ARCH_OK; Arch; crate::target::arch::Ok; "ZE"; "Entry to ze"],
11        ]
12    );
13
14    impl Ok {
15        pub fn from_no(no: usize) -> Self {
16            Ok::Default(no)
17        }
18    }
19}
20
21pub mod error {
22    ample::result!(
23        Error;
24        "Human error";
25        usize;
26        [
27            [1; TARGET_DEFAULT_ERROR; Default; usize; "ZE"; "Entry to ze"],
28            [2; TARGET_INFO_ERROR; Info; usize; "ZE"; "Entry to ze"],
29            [3; TARGET_OS_ERROR; Os; crate::target::os::Error; "ZE"; "Entry to ze"],
30            [4; TARGET_ARCH_ERROR; Arch; crate::target::arch::Error; "ZE"; "Entry to ze"],
31        ]
32    );
33
34    impl Error {
35        pub fn from_no(no: usize) -> Self {
36            Error::Default(no)
37        }
38    }
39}
40
41pub use error::Error;
42pub use ok::Ok;
43
44pub type Result = core::result::Result<Ok, Error>;
45
46// pub fn handle_result(result: usize) -> Result {
47//     if (result as isize) < 0 {
48//         Err(Error::from_no(result))
49//     } else {
50//         Ok(Ok::from_no(result))
51//     }
52// }