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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
result!;
pub type Result = Result;
// // use result::ErrorTrait;
// pub mod error {
// define_error!("ELF", []);
// }
// // define_error_nested! (
// // "ELF",
// // [
// // [0; Elf; self::error; ERR_ELF; "Local error"; "ERR_ELF"],
// // // [1; DType; crate::dtype; ERR_DTYPE; "Datatype erro"; "ERR_DTYPE"],
// // [2; Human; human::result; ERR_HUMAN; "Human error"; "ERR_HUMAN"],
// // [3; Syscall; syscall::result; ERR_SYSCALL; "Syscall error"; "ERR_SYSCALL"]
// // ]
// // );
// pub mod macro_types {
// #[allow(non_camel_case_types)]
// pub type Mi8 = *const i8;
// pub type elf_error = super::error::Error;
// pub type dtype_error = crate::dtype::Error;
// }
// mod ok {
// enum_typed!(Ok; usize; "AT_TYPE"; crate::result::macro_types; [
// [0; Null; usize; |p: Franco| { *p as usize }; AT_NULL; "Null"; "End of vector"],
// [1; Ignore; usize; |p: Franco| { *p as usize }; AT_IGNORE; "Ignore"; "Entry should be ignored"],
// ]);
// }
// error_typed!("ELF Type"; crate::result::macro_types; [
// [0; Elf; elf_error; p; { elf_error::from_ptr(p) }; { p.to_no() as Franco }; ERR_ELF; "ERR_ELF"; "ERR_ELF"],
// [1; DType; dtype_error; p; { dtype_error::from_ptr(p)}; { p as *const dtype_error as Franco}; ERR_DTYPE; "ERR_DTYPE"; "ERR_DTYPE"],
// ]);
// pub type Result = core::result::Result<ok::Ok, Error>;