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
#![feature(allow_internal_unstable)]
#![feature(try_trait)]
#![feature(arbitrary_enum_discriminant)]
#![cfg_attr(not(test), no_std)] // #![no_std] if not testing
#[macro_use]
extern crate arrayref;
use error::*;
pub const FUNC_ID_LEN: usize = 16;
// Type alias for storing func_id
pub type FuncId = arrayvec::ArrayString<[u8; FUNC_ID_LEN]>;

extern crate alloc;
extern crate core;
/// Macro for debugging
///
#[macro_export]
#[allow_internal_unstable(print_internals, format_args_nl)]
macro_rules! debug {
    () => ({
            #[cfg(any(feature="debug",test))]{
                $crate::std::print!("\n");
            }
    });
    ($($arg:tt)*) => ({
        #[cfg(any(feature="debug",test))]{
            {
                std::io::_print(std::format_args_nl!($($arg)*));
            }
        }
    })
}

/// Macro for mapping function_id to function pointer
#[macro_export]
macro_rules! map(
    { $($key:expr => $value:expr),+ } => {
        {
            let mut m = HashMap::new();
            $(
                m.insert($key, $value);
            )+
            m
        }
        };
);

/// Module for error codes
pub mod error;
/// Module for Generic CCSDS Space Packet. SpacePacket struct has only primary header and data field.
pub mod sp;

// TODO : Implement Own Error Types