add typedef for pdu_ids
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
parent
1e7207c230
commit
f245389c02
3 changed files with 22 additions and 1 deletions
|
@ -24,6 +24,10 @@ struct Services {
|
|||
globals: Dep<globals::Service>,
|
||||
}
|
||||
|
||||
pub type ShortEventId = ShortId;
|
||||
pub type ShortRoomId = ShortId;
|
||||
pub type ShortId = u64;
|
||||
|
||||
impl crate::Service for Service {
|
||||
fn build(args: crate::Args<'_>) -> Result<Arc<Self>> {
|
||||
Ok(Arc::new(Self {
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
mod data;
|
||||
mod pduid;
|
||||
|
||||
use std::{
|
||||
cmp,
|
||||
|
@ -38,7 +39,10 @@ use serde::Deserialize;
|
|||
use serde_json::value::{to_raw_value, RawValue as RawJsonValue};
|
||||
|
||||
use self::data::Data;
|
||||
pub use self::data::PdusIterItem;
|
||||
pub use self::{
|
||||
data::PdusIterItem,
|
||||
pduid::{PduId, RawPduId},
|
||||
};
|
||||
use crate::{
|
||||
account_data, admin, appservice, appservice::NamespaceRegex, globals, pusher, rooms,
|
||||
rooms::state_compressor::CompressedStateEvent, sending, server_keys, users, Dep,
|
||||
|
|
13
src/service/rooms/timeline/pduid.rs
Normal file
13
src/service/rooms/timeline/pduid.rs
Normal file
|
@ -0,0 +1,13 @@
|
|||
use crate::rooms::short::{ShortEventId, ShortRoomId};
|
||||
|
||||
#[derive(Clone, Copy)]
|
||||
pub struct PduId {
|
||||
_room_id: ShortRoomId,
|
||||
_event_id: ShortEventId,
|
||||
}
|
||||
|
||||
pub type RawPduId = [u8; PduId::LEN];
|
||||
|
||||
impl PduId {
|
||||
pub const LEN: usize = size_of::<ShortRoomId>() + size_of::<ShortEventId>();
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue