impl Default for ServerConfig {
fn default() -> ServerConfig {
- let spec : ServerConfigSpec = toml_de::from_str(r#"
+ let spec: ServerConfigSpec = toml_de::from_str(r#"
public_url = "INTERNAL ERROR"
"#)
.expect("parse dummy config as ServerConfigSpec");
use crate::imports::*;
#[derive(Debug)]
-pub struct DebugReader<T : Read>(pub T, pub ClientId);
+pub struct DebugReader<T:Read>(pub T, pub ClientId);
-impl<T : Read> Read for DebugReader<T> {
- fn read(&mut self, buf: &mut [u8]) -> Result<usize,io::Error> {
+impl<T: Read> Read for DebugReader<T> {
+ fn read(&mut self, buf: &mut [u8]) -> Result<usize, io::Error> {
let l = buf.len();
trace!("{} read({})...", &self.1, l);
let r = self.0.read(buf);
a.chain()
.map(ToString::to_string)
.collect::<Vec<_>>()
- .join(": ")
+ .join(": "),
)
}
}
impl From<InternalError> for SpecError {
fn from(ie: InternalError) -> SpecError {
- SpecError::InternalError(format!("{:?}",ie))
+ SpecError::InternalError(format!("{:?}", ie))
}
}
#[derive(Error,Debug,Serialize,Clone)]
pub trait IdForById {
type Error;
#[allow(clippy::declare_interior_mutable_const)]
-// https://github.com/rust-lang/rust-clippy/issues/3962#issuecomment-667957112
- const ERROR : Self::Error;
+ // https://github.com/rust-lang/rust-clippy/issues/3962#issuecomment-667957112
+ const ERROR: Self::Error;
}
macro_rules! some_slotmap {
($slotmap:ident) => {
- impl<I:IdForById+slotmap::Key, T> ById for $slotmap<I,T> {
+ impl<I: IdForById + slotmap::Key, T> ById for $slotmap<I,T> {
type Id = I;
type Entry = T;
type Error = <I as IdForById>::Error;
#[derive(Copy,Clone,Debug,Ord,PartialOrd,Eq,PartialEq)]
#[derive(Serialize,Deserialize)]
#[serde(transparent)]
-pub struct Generation (pub u64);
+pub struct Generation(pub u64);
visible_slotmap_key!{ VisiblePieceId('.') }