Files
continuwuity/src/core/pdu/id.rs
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

23 lines
482 B
Rust
Raw Normal View History

2024-11-07 03:30:47 +00:00
use super::{Count, RawId};
2024-11-02 06:12:54 +00:00
use crate::utils::u64_from_u8x8;
pub type ShortRoomId = ShortId;
pub type ShortEventId = ShortId;
pub type ShortId = u64;
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
2024-11-07 03:30:47 +00:00
pub struct Id {
2024-11-02 06:12:54 +00:00
pub shortroomid: ShortRoomId,
2024-11-07 03:30:47 +00:00
pub shorteventid: Count,
2024-11-02 06:12:54 +00:00
}
2024-11-07 03:30:47 +00:00
impl From<RawId> for Id {
2024-11-02 06:12:54 +00:00
#[inline]
2024-11-07 03:30:47 +00:00
fn from(raw: RawId) -> Self {
2024-11-02 06:12:54 +00:00
Self {
shortroomid: u64_from_u8x8(raw.shortroomid()),
2024-11-07 03:30:47 +00:00
shorteventid: Count::from_unsigned(u64_from_u8x8(raw.shorteventid())),
2024-11-02 06:12:54 +00:00
}
}
}