[Add] Structure
This commit is contained in:
parent
a642afce5a
commit
c363ea48d0
27 changed files with 1730 additions and 1400 deletions
|
|
@ -1,2 +1,16 @@
|
|||
pub mod file_util;
|
||||
pub mod logger;
|
||||
|
||||
use mtp::codec::{DataType, DataTypeId, TypeMap};
|
||||
|
||||
/*
|
||||
* Omikron serializes fields using the latest TypeMap, whose built-in fields
|
||||
* are required by the protocol. Keep the invariant in one place while using
|
||||
* the non-deprecated conversion API.
|
||||
*/
|
||||
pub fn data_type_id(data_type: DataType, type_map: &TypeMap) -> DataTypeId {
|
||||
let Some(id) = data_type.try_to_id(type_map) else {
|
||||
panic!("required data type is missing from the TypeMap: {data_type:?}");
|
||||
};
|
||||
id
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue