2022-10-23 22:32:30 +02:00
|
|
|
#![allow(dead_code, unused_imports)]
|
2022-10-22 17:16:28 +02:00
|
|
|
|
2022-10-25 23:38:45 +02:00
|
|
|
use fsrc_core::events::{
|
|
|
|
EventU32, EventU32TypedSev, GenericEvent, HasSeverity, LargestEventRaw, LargestGroupIdRaw,
|
|
|
|
Severity, SeverityInfo, SeverityLow, SeverityMedium,
|
|
|
|
};
|
2022-10-24 14:03:21 +02:00
|
|
|
use std::convert::AsRef;
|
|
|
|
|
|
|
|
#[derive(Debug)]
|
2022-10-23 22:32:30 +02:00
|
|
|
struct GroupIdIntrospection {
|
|
|
|
name: &'static str,
|
|
|
|
id: LargestGroupIdRaw,
|
|
|
|
}
|
|
|
|
|
2022-10-24 14:03:21 +02:00
|
|
|
#[derive(Debug)]
|
|
|
|
struct EventIntrospection {
|
2022-10-23 22:32:30 +02:00
|
|
|
name: &'static str,
|
|
|
|
group_id: GroupIdIntrospection,
|
2022-10-24 14:03:21 +02:00
|
|
|
event: &'static EventU32,
|
2022-10-23 22:32:30 +02:00
|
|
|
info: &'static str,
|
|
|
|
}
|
|
|
|
|
|
|
|
//#[event(descr="This is some info event")]
|
2022-10-24 01:51:33 +02:00
|
|
|
const INFO_EVENT_0: EventU32TypedSev<SeverityInfo> = EventU32TypedSev::const_new(0, 0);
|
2022-10-24 14:03:21 +02:00
|
|
|
const INFO_EVENT_0_ERASED: EventU32 = EventU32::const_from_info(INFO_EVENT_0);
|
2022-10-23 22:32:30 +02:00
|
|
|
|
|
|
|
// This is ideally auto-generated
|
2022-10-24 14:03:21 +02:00
|
|
|
const INFO_EVENT_0_INTROSPECTION: EventIntrospection = EventIntrospection {
|
2022-10-23 22:32:30 +02:00
|
|
|
name: "INFO_EVENT_0",
|
|
|
|
group_id: GroupIdIntrospection {
|
|
|
|
id: 0,
|
|
|
|
name: "Group ID 0 without name",
|
|
|
|
},
|
2022-10-24 14:03:21 +02:00
|
|
|
event: &INFO_EVENT_0_ERASED,
|
2022-10-23 22:32:30 +02:00
|
|
|
info: "This is some info event",
|
|
|
|
};
|
|
|
|
|
|
|
|
//#[event(descr="This is some low severity event")]
|
2022-10-24 01:51:33 +02:00
|
|
|
const SOME_LOW_SEV_EVENT: EventU32TypedSev<SeverityLow> = EventU32TypedSev::const_new(0, 12);
|
2022-10-23 22:32:30 +02:00
|
|
|
|
2022-10-24 01:51:33 +02:00
|
|
|
//const EVENT_LIST: [&'static Event; 2] = [&INFO_EVENT_0, &SOME_LOW_SEV_EVENT];
|
2022-10-23 22:32:30 +02:00
|
|
|
|
|
|
|
//#[event_group]
|
|
|
|
const TEST_GROUP_NAME: u16 = 1;
|
|
|
|
// Auto-generated?
|
2022-10-25 23:32:12 +02:00
|
|
|
const TEST_GROUP_NAME_NAME: &str = "TEST_GROUP_NAME";
|
2022-10-23 22:32:30 +02:00
|
|
|
|
|
|
|
//#[event(desc="Some medium severity event")]
|
2022-10-24 01:51:33 +02:00
|
|
|
const MEDIUM_SEV_EVENT_IN_OTHER_GROUP: EventU32TypedSev<SeverityMedium> =
|
|
|
|
EventU32TypedSev::const_new(TEST_GROUP_NAME, 0);
|
2022-10-25 23:38:45 +02:00
|
|
|
const MEDIUM_SEV_EVENT_IN_OTHER_GROUP_REDUCED: EventU32 =
|
|
|
|
EventU32::const_from_medium(MEDIUM_SEV_EVENT_IN_OTHER_GROUP);
|
2022-10-23 22:32:30 +02:00
|
|
|
|
|
|
|
// Also auto-generated
|
2022-10-25 23:38:45 +02:00
|
|
|
const MEDIUM_SEV_EVENT_IN_OTHER_GROUP_INTROSPECTION: EventIntrospection = EventIntrospection {
|
|
|
|
name: "MEDIUM_SEV_EVENT_IN_OTHER_GROUP",
|
|
|
|
group_id: GroupIdIntrospection {
|
|
|
|
name: TEST_GROUP_NAME_NAME,
|
|
|
|
id: TEST_GROUP_NAME,
|
|
|
|
},
|
|
|
|
event: &MEDIUM_SEV_EVENT_IN_OTHER_GROUP_REDUCED,
|
|
|
|
info: "Some medium severity event",
|
|
|
|
};
|
2022-10-23 22:32:30 +02:00
|
|
|
|
2022-10-24 14:03:21 +02:00
|
|
|
const CONST_SLICE: &'static [u8] = &[0, 1, 2, 3];
|
2022-10-25 23:38:45 +02:00
|
|
|
const INTROSPECTION_FOR_TEST_GROUP_0: [&EventIntrospection; 2] =
|
|
|
|
[&INFO_EVENT_0_INTROSPECTION, &INFO_EVENT_0_INTROSPECTION];
|
2022-10-24 14:03:21 +02:00
|
|
|
|
2022-10-25 23:32:12 +02:00
|
|
|
//const INTROSPECTION_FOR_TABLE: &'static [&EventIntrospection] = &INTROSPECTION_FOR_TEST_GROUP_0;
|
2022-10-24 14:03:21 +02:00
|
|
|
|
2022-10-25 23:38:45 +02:00
|
|
|
const INTROSPECTION_FOR_TEST_GROUP_NAME: [&EventIntrospection; 1] =
|
|
|
|
[&MEDIUM_SEV_EVENT_IN_OTHER_GROUP_INTROSPECTION];
|
2022-10-25 23:32:12 +02:00
|
|
|
//const BLAH: &'static [&EventIntrospection] = &INTROSPECTION_FOR_TEST_GROUP_NAME;
|
2022-10-24 14:03:21 +02:00
|
|
|
|
2022-10-25 23:32:12 +02:00
|
|
|
const ALL_EVENTS: [&[&EventIntrospection]; 2] = [
|
|
|
|
&INTROSPECTION_FOR_TEST_GROUP_0,
|
2022-10-25 23:38:45 +02:00
|
|
|
&INTROSPECTION_FOR_TEST_GROUP_NAME,
|
2022-10-24 14:03:21 +02:00
|
|
|
];
|
|
|
|
|
2022-10-23 22:32:30 +02:00
|
|
|
#[test]
|
|
|
|
fn main() {
|
2022-10-24 01:51:33 +02:00
|
|
|
//let test = stringify!(INFO_EVENT);
|
|
|
|
//println!("{:?}", test);
|
|
|
|
//for event in EVENT_LIST {
|
|
|
|
// println!("{:?}", event);
|
|
|
|
//}
|
2022-10-24 14:03:21 +02:00
|
|
|
for events in ALL_EVENTS.into_iter().flatten() {
|
|
|
|
dbg!("{:?}", events);
|
|
|
|
}
|
|
|
|
//for introspection_info in INTROSPECTION_FOR_TEST_GROUP {
|
|
|
|
// dbg!("{:?}", introspection_info);
|
|
|
|
//}
|
2022-10-23 22:32:30 +02:00
|
|
|
//let test_struct =
|
|
|
|
}
|