refactor for stronger RawPduId type
implement standard traits for PduCount enable serde for arrayvec typedef various shortid's pducount simplifications split parts of pdu_metadata service to core/pdu and api/relations remove some yields; improve var names/syntax tweak types for limit timeline limit arguments Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
parent
2e4d9cb37c
commit
9da523c004
41 changed files with 796 additions and 573 deletions
22
src/core/pdu/id.rs
Normal file
22
src/core/pdu/id.rs
Normal file
|
@ -0,0 +1,22 @@
|
|||
use super::{PduCount, RawPduId};
|
||||
use crate::utils::u64_from_u8x8;
|
||||
|
||||
pub type ShortRoomId = ShortId;
|
||||
pub type ShortEventId = ShortId;
|
||||
pub type ShortId = u64;
|
||||
|
||||
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
||||
pub struct PduId {
|
||||
pub shortroomid: ShortRoomId,
|
||||
pub shorteventid: PduCount,
|
||||
}
|
||||
|
||||
impl From<RawPduId> for PduId {
|
||||
#[inline]
|
||||
fn from(raw: RawPduId) -> Self {
|
||||
Self {
|
||||
shortroomid: u64_from_u8x8(raw.shortroomid()),
|
||||
shorteventid: PduCount::from_unsigned(u64_from_u8x8(raw.shorteventid())),
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue