oxedyne/fe2o3/fe2o3_net/src/id.rs
655 bytes, 3 runs
created by r1870400018:587, which is this file's identity for as long as the history lasts, whatever it is later renamed to
download · who wrote it · its history
| 1 | use oxedyne_fe2o3_jdat::id::IdDat; |
| 2 | |
| 3 | use std::{ |
| 4 | mem, |
| 5 | }; |
| 6 | |
| 7 | //// Protocol identifier types for defaults and testing. |
| 8 | pub type BidTyp = u64; // Bot Id |
| 9 | pub type MidTyp = u64; // Message Id |
| 10 | pub type SidTyp = u64; // State Id (e.g. for sessions) |
| 11 | pub type UidTyp = u128; // User Id |
| 12 | |
| 13 | pub const BID_LEN: usize = mem::size_of::<BidTyp>(); |
| 14 | pub const MID_LEN: usize = mem::size_of::<MidTyp>(); |
| 15 | pub const SID_LEN: usize = mem::size_of::<SidTyp>(); |
| 16 | pub const UID_LEN: usize = mem::size_of::<UidTyp>(); |
| 17 | |
| 18 | pub type Bid = IdDat<{BID_LEN}, BidTyp>; |
| 19 | pub type Mid = IdDat<{MID_LEN}, MidTyp>; |
| 20 | pub type Sid = IdDat<{SID_LEN}, SidTyp>; |
| 21 | pub type Uid = IdDat<{UID_LEN}, UidTyp>; |