pub mod api;
pub mod cmdlistener;
pub mod session;
+pub mod sse;
pub use rocket::http::Status;
pub use rocket::http::{ContentType, RawStr};
#![allow(clippy::while_let_loop)]
#![allow(clippy::blocks_in_if_conditions)]
-use crate::prelude::*;
-
-use vecdeque_stableix::Offset as StableIndexOffset;
-use std::ops::Neg;
+use otter::prelude::*;
// ---------- basic definitions ----------
-#[derive(Copy,Clone,Debug,Eq,PartialEq,Ord,PartialOrd)]
-#[derive(Serialize,Deserialize)]
-#[serde(transparent)]
-pub struct UpdateId(i64);
-
const UPDATE_READER_SIZE: usize = 1024*32;
const UPDATE_MAX_FRAMING_SIZE: usize = 200;
const UPDATE_KEEPALIVE: Duration = Duration::from_secs(14);
}
}
-// ---------- support implementation ----------
-
-impl Neg for UpdateId {
- type Output = Self;
- fn neg(self) -> Self { UpdateId(-self.0) }
-}
-
-impl Display for UpdateId {
- fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
- Display::fmt(&self.0, f)
- }
-}
-
-impl Bounded for UpdateId {
- fn max_value() -> Self { UpdateId(Bounded::max_value()) }
- fn min_value() -> Self { UpdateId(Bounded::min_value()) }
-}
-
-impl StableIndexOffset for UpdateId {
- fn try_increment(&mut self) -> Option<()> { self.0.try_increment() }
- fn try_decrement(&mut self) -> Option<()> { self.0.try_decrement() }
- fn index_input(&self, input: Self) -> Option<usize> {
- self.0.index_input(input.0)
- }
- fn index_output(&self, inner: usize) -> Option<Self> {
- self.0.index_output(inner).map(UpdateId)
- }
- fn zero() -> Self { UpdateId(0) }
-}
-
// ---------- entrypoint for dribbling the http response ----------
#[throws(Fatal)]
pub mod progress;
pub mod shapelib;
pub mod spec;
-pub mod sse;
pub mod termprogress;
pub mod timedfd;
pub mod tz;
pub use unicase::UniCase;
pub use url::Url;
pub use vecdeque_stableix::Deque as StableIndexVecDeque;
+pub use vecdeque_stableix::Offset as StableIndexOffset;
pub use void::{unreachable, Void, ResultVoidExt, ResultVoidErrExt};
pub use crate::imports::zipfile::{self, read::ZipFile, result::ZipError};
pub use crate::slotmap_slot_idx::*;
pub use crate::spec::*;
pub use crate::spec::piece_specs::{FaceColourSpecs, SimpleCommon};
-pub use crate::sse;
pub use crate::toml_de;
pub use crate::timedfd::*;
pub use crate::termprogress;
use crate::prelude::*;
+use std::ops::Neg;
+
#[path="movehist.rs"] pub mod movehist;
#[allow(non_camel_case_types)] type TUE_P<'u> = TransmitUpdateEntry_Piece<'u>;
// ---------- newtypes, type aliases, basic definitions ----------
+#[derive(Copy,Clone,Debug,Eq,PartialEq,Ord,PartialOrd)]
+#[derive(Serialize,Deserialize)]
+#[serde(transparent)]
+pub struct UpdateId(i64);
+
pub type RawClientSequence = u64;
#[derive(Debug,Copy,Clone,Eq,PartialEq,Deserialize,Serialize)]
// ---------- prepared updates, queued in memory ----------
pub type PlayerUpdatesLog =
- StableIndexVecDeque<Arc<PreparedUpdate>,sse::UpdateId>;
+ StableIndexVecDeque<Arc<PreparedUpdate>,UpdateId>;
#[derive(Debug)]
pub struct PlayerUpdates {
log_did_to_piece_whoby(ioccults,goccults,by_gpl,gpc,ipc,did)?.0
}
+// ---------- support implementation ----------
+
+impl Neg for UpdateId {
+ type Output = Self;
+ fn neg(self) -> Self { UpdateId(-self.0) }
+}
+
+impl Display for UpdateId {
+ fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
+ Display::fmt(&self.0, f)
+ }
+}
+
+impl Bounded for UpdateId {
+ fn max_value() -> Self { UpdateId(Bounded::max_value()) }
+ fn min_value() -> Self { UpdateId(Bounded::min_value()) }
+}
+
+impl StableIndexOffset for UpdateId {
+ fn try_increment(&mut self) -> Option<()> { self.0.try_increment() }
+ fn try_decrement(&mut self) -> Option<()> { self.0.try_decrement() }
+ fn index_input(&self, input: Self) -> Option<usize> {
+ self.0.index_input(input.0)
+ }
+ fn index_output(&self, inner: usize) -> Option<Self> {
+ self.0.index_output(inner).map(UpdateId)
+ }
+ fn zero() -> Self { UpdateId(0) }
+}
+
// ---------- prepared updates, queued in memory ----------
pub struct PlayerUpdatesBuildContext {