Currently this only has tz.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
"bundle-sources",
"byteorder",
"cast_trait_object",
- "chrono",
- "chrono-tz",
"console",
"const-default",
"crossbeam-utils",
"lazy-regex",
"lazy_static",
"libc",
- "log",
"mio 0.8.2",
"nix 0.23.1",
"num",
"once_cell",
"openssh-keys",
"ordered-float",
- "otter-base",
- "parking_lot",
+ "otter-support",
"paste",
"percent-encoding",
"pwd",
"subtle",
"tempfile",
"tera",
+ "thiserror",
"toml",
"typetag",
"uds",
"structopt",
]
+[[package]]
+name = "otter-support"
+version = "1.0.0"
+dependencies = [
+ "chrono",
+ "chrono-tz",
+ "fehler",
+ "log",
+ "otter-base",
+ "parking_lot",
+ "serde",
+ "serde_with",
+]
+
[[package]]
name = "otter-wasm"
version = "1.0.0"
[package]
name="otter"
-description="Otter game system; common infrastructure Rust crate."
+description="Otter game system; main data structures Rust crate."
version="1.0.0"
license="AGPL-3.0-or-later"
[dependencies]
-otter-base.path="base"
-otter-base.version="=1.0.0"
+otter-support.path="support"
+otter-support.version="=1.0.0"
anyhow="1"
backtrace="0.3"
boolinator="2"
byteorder="1.3"
cast_trait_object="0.1"
-chrono="0.4"
-chrono-tz="0.6"
console="0.15"
crossbeam-utils="0.8"
delegate="0.6"
either="1"
enum_dispatch="0.3.5"
env_logger="0.9"
-fehler="1"
fs2="0.4"
glob="0.3"
humantime-serde="1"
lazy-regex="2"
lazy_static="1"
libc="0.2"
-log="0.4"
nix="0.23"
num="0.4"
num-derive="0.3"
openssh-keys="0.5"
ordered-float="2"
paste="1"
-parking_lot="0.12"
percent-encoding="2"
pwd="1"
rand="0.8"
regex="1"
rmp="0.8"
rmp-serde="1"
-serde_with="1"
structopt="0.3"
sha2="0.10"
subtle="2.4"
image = { version = "0.24", default-features=false, features=["jpeg","png"] }
index_vec = { version="0.1.1", features=["serde" ] }
mio = { version="0.8", features=["os-ext", "os-poll" ] }
-serde = { version="1" , features=["derive", "rc"] }
strum = { version="0.24" , features=["derive" ] }
slotmap = { package="slotmap-fork-otter", version="1", git="https://github.com/ijackson/slotmap", branch="slotmap-fork-otter", features=["serde"] }
+# Repeated in other Cargo.toml's because importing does not work properly
+fehler="1"
+serde = { version="1" , features=["derive", "rc"] }
+serde_with="1"
+thiserror="1"
+
#fin.
pub mod cleanup_notify {
use super::imports::*;
use super::AE;
+ pub use super::Void; // TODO remove the need for this
use anyhow::Context;
use fehler::{throw, throws};
use nix::{unistd::*, fcntl::OFlag};
use nix::sys::signal::*;
use nix::Error as NE;
- use void::Void;
use std::io;
use std::os::unix::io::RawFd;
use std::panic::catch_unwind;
pub mod imports;
pub mod prelude;
+#[path="prelude-part.rs"]
+pub mod prelude_part;
+
pub mod geometry;
pub mod html;
pub mod zcoord;
--- /dev/null
+// Copyright 2020-2021 Ian Jackson and contributors to Otter
+// SPDX-License-Identifier: AGPL-3.0-or-later
+// There is NO WARRANTY.
+
+pub use std::borrow::Borrow;
+pub use std::cmp::{max, Ordering};
+pub use std::convert::{TryFrom, TryInto};
+pub use std::f64::consts::TAU;
+pub use std::fmt::{self, Debug, Display, Formatter, Write as _};
+pub use std::hash::{Hash, Hasher};
+pub use std::iter::{self, FusedIterator};
+pub use std::mem;
+pub use std::num::{TryFromIntError, Wrapping};
+pub use std::ops::{Deref, DerefMut, Index, IndexMut};
+pub use std::str;
+pub use std::str::FromStr;
+
+pub use arrayvec::ArrayVec;
+pub use derive_more::*;
+pub use extend::ext;
+pub use fehler::{throw, throws};
+pub use if_chain::if_chain;
+pub use itertools::{chain, iproduct, izip, zip_eq, EitherOrBoth, Itertools};
+pub use serde::{Deserialize, Serialize};
+pub use serde_with::DeserializeFromStr;
+pub use serde_with::SerializeDisplay;
+pub use thiserror::Error;
+pub use void::Void;
+
+pub use crate::html::*;
+
+pub use crate::{pos_zip_map, pos_zip_try_map};
+pub use crate::geometry::{CoordinateOverflow, PosC, PosPromote};
+pub use crate::{dbgc, hformat, hformat_as_display, hwrite};
+pub use crate::misc::default;
+pub use crate::misc::display_as_debug;
+
+pub use crate::if_let;
// SPDX-License-Identifier: AGPL-3.0-or-later
// There is NO WARRANTY.
-pub use std::borrow::Borrow;
-pub use std::cmp::{max, Ordering};
-pub use std::convert::{TryFrom, TryInto};
-pub use std::f64::consts::TAU;
-pub use std::fmt::{self, Debug, Display, Formatter, Write as _};
-pub use std::hash::{Hash, Hasher};
-pub use std::iter::{self, FusedIterator};
-pub use std::mem;
-pub use std::num::{TryFromIntError, Wrapping};
-pub use std::ops::{Deref, DerefMut, Index, IndexMut};
-pub use std::str;
-pub use std::str::FromStr;
-
-pub use arrayvec::ArrayVec;
-pub use derive_more::*;
-pub use extend::ext;
-pub use fehler::{throw, throws};
-pub use if_chain::if_chain;
-pub use itertools::izip;
-pub use serde::{Deserialize, Serialize};
-pub use serde_with::DeserializeFromStr;
-pub use serde_with::SerializeDisplay;
-pub use thiserror::Error;
-pub use void::{self, Void};
-
-pub use crate::html::*;
-
-pub use crate::{pos_zip_map, pos_zip_try_map};
-pub use crate::geometry::{CoordinateOverflow, PosC, PosPromote};
-pub use crate::{dbgc, hformat, hformat_as_display, hwrite};
-pub use crate::misc::default;
-pub use crate::misc::display_as_debug;
-
-pub use crate::if_let;
+pub use crate::imports::*;
+pub use crate::prelude_part::*;
// SPDX-License-Identifier: AGPL-3.0-or-later
// There is NO WARRANTY.
-use crate::imports::*;
+//use crate::imports::*;
use super::*;
visible_slotmap_key!{ VisiblePieceId(b'.') }
-#[derive(Copy,Clone,Debug,Serialize,Deserialize,Eq,Ord,PartialEq,PartialOrd)]
-#[serde(transparent)]
-pub struct Timestamp(pub u64); /* time_t */
-
#[derive(Copy,Clone,Debug,Eq,Ord,PartialEq,PartialOrd)]
pub struct SpecDepth(u16);
}
}
-impl Timestamp {
- /// Always >= previously
- pub fn now() -> Timestamp {
- use std::time::SystemTime;
- let now = SystemTime::now()
- .duration_since(SystemTime::UNIX_EPOCH)
- .unwrap()
- .as_secs();
- Timestamp(now)
- }
-
- pub fn render(&self, tz: &Timezone) -> String {
- tz.format(*self)
- }
-}
-
#[derive(Error, Debug)]
#[error("{self:?}")]
pub struct PieceTraitDowncastFailed<'p> {
// SPDX-License-Identifier: AGPL-3.0-or-later
// There is NO WARRANTY.
-pub use otter_base;
-pub use otter_base::imports::*;
+pub use otter_support;
pub use anyhow;
pub use async_condvar_fair;
pub use base64;
pub use boolinator;
pub use cast_trait_object;
-pub use chrono;
-pub use chrono_tz;
pub use delegate;
pub use digest;
pub use educe;
pub use lazy_static;
pub use inventory;
pub use libc;
-pub use log;
pub use nix;
pub use once_cell;
pub use ordered_float;
-pub use parking_lot;
pub use pwd;
pub use regex;
pub use rmp_serde;
pub mod imports;
pub mod prelude;
+#[path="prelude-part.rs"]
+pub mod prelude_part;
+
pub mod accounts;
pub mod asseturl;
pub mod authproofs;
pub mod spec;
pub mod termprogress;
pub mod timedfd;
-pub mod tz;
pub mod updates;
pub mod ui;
pub mod utils;
--- /dev/null
+// Copyright 2020-2021 Ian Jackson and contributors to Otter
+// SPDX-License-Identifier: AGPL-3.0-or-later
+// There is NO WARRANTY.
+
+use crate::imports::*;
+use otter_support::imports::*;
+use otter_base::imports::*;
+
+use otter_base::prelude_part::*;
+
+pub use std::any::Any;
+pub use std::borrow::Cow;
+pub use std::cmp::{self, max, min, Ordering};
+pub use std::collections::VecDeque;
+pub use std::collections::{btree_map, BTreeMap};
+pub use std::collections::{btree_set, BTreeSet};
+pub use std::convert::{Infallible, TryFrom, TryInto};
+pub use std::env;
+pub use std::error::Error;
+pub use std::ffi::OsStr;
+pub use std::fmt::Formatter;
+pub use std::fmt::Write as _;
+pub use std::fmt::{self, Debug, Display};
+pub use std::fs;
+pub use std::fs::File;
+pub use std::hash::Hash;
+pub use std::io;
+pub use std::io::ErrorKind;
+pub use std::io::{BufRead, BufReader, BufWriter, Read, Write};
+pub use std::iter;
+pub use std::iter::{repeat_with};
+pub use std::marker::PhantomData;
+pub use std::num::{NonZeroUsize, TryFromIntError, Wrapping};
+pub use std::os::linux::fs::MetadataExt as _; // todo why linux for st_mode??
+pub use std::os::unix;
+pub use std::os::unix::ffi::OsStrExt;
+pub use std::os::unix::fs::{MetadataExt, OpenOptionsExt};
+pub use std::os::unix::io::{AsRawFd, IntoRawFd, RawFd};
+pub use std::os::unix::net::UnixStream;
+pub use std::os::unix::process::{CommandExt, ExitStatusExt};
+pub use std::net::{IpAddr, SocketAddr, ToSocketAddrs, Ipv6Addr, Ipv4Addr};
+pub use std::path::PathBuf;
+pub use std::process::{exit, Child, Command, Stdio};
+pub use std::str;
+pub use std::str::FromStr;
+pub use std::string::ParseError;
+pub use std::sync::atomic::AtomicBool;
+pub use std::sync::mpsc;
+pub use std::thread::{self, sleep};
+pub use std::time::{self, Duration, Instant};
+
+pub use anyhow::{anyhow, ensure, Context};
+pub use async_condvar_fair::{Condvar, BatonExt as _};
+pub use boolinator::Boolinator as _;
+pub use byteorder::{BigEndian, LittleEndian, ReadBytesExt, WriteBytesExt};
+pub use cast_trait_object::{dyn_upcast, DynCastExt};
+pub use const_default::ConstDefault;
+pub use delegate::delegate;
+pub use derive_into_owned::IntoOwned;
+pub use digest::Digest;
+pub use downcast_rs::{impl_downcast, Downcast};
+pub use educe::Educe;
+pub use either::{Either, Left, Right};
+pub use enum_dispatch::enum_dispatch;
+pub use enum_map::{Enum, EnumMap};
+pub use fehler::{throw, throws};
+pub use flexi_logger::LogSpecification;
+pub use fs2::FileExt;
+pub use index_vec::{define_index_type, index_vec, IndexSlice, IndexVec};
+pub use lazy_regex::regex;
+pub use lazy_static::lazy_static;
+pub use log::{log, log_enabled};
+pub use nix::unistd::{self, Uid};
+pub use nix::sys::time::TimeSpec;
+pub use nix::time::clock_gettime;
+pub use num_derive::{ToPrimitive, FromPrimitive};
+pub use num_traits::{Bounded, FromPrimitive, ToPrimitive};
+pub use ordered_float::OrderedFloat;
+pub use paste::paste;
+pub use percent_encoding::percent_decode_str;
+pub use percent_encoding::utf8_percent_encode;
+pub use percent_encoding::NON_ALPHANUMERIC;
+pub use rand::distributions::Alphanumeric;
+pub use rand::thread_rng;
+pub use rand::Rng;
+pub use rand::prelude::SliceRandom;
+pub use regex::Regex;
+pub use sha2::{Sha512, Sha512_256};
+pub use slotmap::{dense::DenseSlotMap, SparseSecondaryMap, Key as _};
+pub use strum::{EnumCount, EnumDiscriminants};
+pub use strum::{EnumString, EnumIter, EnumMessage, EnumProperty};
+pub use strum::{AsRefStr, IntoEnumIterator, IntoStaticStr};
+pub use subtle::ConstantTimeEq;
+pub use tempfile::{self, NamedTempFile};
+pub use tera::Tera;
+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};
+
+use nix::time::ClockId;
+pub const CLOCK_REALTIME : ClockId = ClockId::CLOCK_REALTIME ;
+pub const CLOCK_MONOTONIC: ClockId = ClockId::CLOCK_MONOTONIC;
+
+pub use otter_base::{pos_zip_map, pos_zip_try_map};
+pub use otter_base::geometry::{self,Coord,Pos,PosC,Rect,RectC};
+pub use otter_base::geometry::{CoordinateOverflow,Region};
+pub use otter_base::zcoord::{self, ZCoord};
+pub use otter_base::misc as base_misc;
+pub use otter_base::dbgc;
+pub use base_misc::*;
+
+pub use crate::{deref_to_field, deref_to_field_mut};
+pub use crate::ensure_eq;
+pub use crate::format_by_fmt_hex;
+pub use crate::impl_via_ambassador;
+pub use crate::matches_doesnot;
+pub use crate::trace_dbg;
+pub use crate::{want, wantok, wants, want_let, want_failed_internal};
+pub use crate::serde_with_compat;
+
+pub use crate::accounts::loaded_acl::{self, EffectiveACL, LoadedAcl, PermSet};
+pub use crate::accounts::*;
+pub use crate::authproofs::{self, Authorisation, Unauthorised};
+pub use crate::authproofs::AuthorisationSuperuser;
+pub use crate::asseturl::*;
+pub use crate::bundles::{self, InstanceBundles, MgmtBundleListExt};
+pub use crate::childio;
+pub use crate::commands::{AccessTokenInfo, AccessTokenReport, MgmtError};
+pub use crate::commands::{MgmtCommand, MgmtResponse};
+pub use crate::commands::{MgmtGameInstruction, MgmtGameResponse};
+pub use crate::commands::{MgmtBundleList, MgmtGameUpdateMode};
+pub use crate::commands::{ProgressUpdateMode};
+pub use crate::config::*;
+pub use crate::debugmutex::DebugIdentify;
+pub use crate::debugreader::DebugReader;
+pub use crate::digestrw::{self, *};
+pub use crate::error::*;
+pub use crate::fake_rng::*;
+pub use crate::fake_time::*;
+pub use crate::fastsplit::*;
+pub use crate::gamestate::*;
+pub use crate::global::*;
+pub use crate::hidden::*;
+pub use crate::keydata::*;
+pub use crate::nwtemplates;
+pub use crate::materials_format;
+pub use crate::mgmtchannel::*;
+pub use crate::occultilks::*;
+pub use crate::organise;
+pub use crate::packetframe::{FrameReader, FrameWriter, ReadFrame, WriteFrame};
+pub use crate::packetframe::{ReadExt, ResponseWriter};
+pub use crate::pcaliases::*;
+pub use crate::pcrender::*;
+pub use crate::pieces::*;
+pub use crate::progress::{self, ProgressInfo, OriginatorExt as _};
+pub use crate::shapelib;
+pub use crate::shapelib::{CircleShape, RectShape};
+pub use crate::shapelib::{ItemEnquiryData, LibraryEnquiryData};
+pub use crate::shapelib::{LibraryLoadError};
+pub use crate::slotmap_slot_idx::*;
+pub use crate::spec::*;
+pub use crate::spec::piece_specs::{FaceColourSpecs, SimpleCommon};
+pub use crate::toml_de;
+pub use crate::timedfd::*;
+pub use crate::termprogress;
+pub use crate::updates::*;
+pub use crate::utils::*;
+pub use crate::ui::*;
+
+pub use crate::gamestate::RefTraitObjectPieceTraitExt as _;
+pub use crate::fastsplit::RefTraitObjectPieceTraitExt as _;
+
+pub type SecondarySlotMap<K,V> = slotmap::secondary::SecondaryMap<K,V>;
+pub type SvgData = Vec<u8>;
+pub type Colour = Html;
+
+pub const MS: time::Duration = time::Duration::from_millis(1);
+
+// ---------- type abbreviations ----------
+
+pub type AE = anyhow::Error;
+
+// accounts.rs
+pub type AS = AccountScope;
+
+// commands.rs
+pub type MC = MgmtCommand;
+pub type ME = MgmtError;
+pub type MGI = MgmtGameInstruction;
+pub type MGR = MgmtGameResponse;
+pub type MR = MgmtResponse;
+pub type PUM = ProgressUpdateMode;
+
+// error.rs
+pub type APOE = ApiPieceOpError;
+pub type ESVU<POEPU,EM> = ErrorSignaledViaUpdate<POEPU,EM>;
+pub type IE = InternalError;
+pub type Ia = Inapplicable;
+pub type POEPP = PieceOpErrorPartiallyProcessed;
+pub type SvgE = SVGProcessingError;
+pub type SpE = SpecError;
+
+// gamestate.rs
+pub use PieceLoadArgs as PLA;
+
+// hidden.rs
+pub type OccK = OccultationKind;
+pub use OccultationKindGeneral as OccKG;
+pub use OccultationKindAlwaysOk as OccKA;
+
+// materials-format.rs
+
+pub use materials_format::VersionError as MFVE;
+
+// occultilks.rs
+pub type LOI = LOccultIlk;
+pub type IOI = IOccultIlk;
+
+// pcrender.rs
+pub use PriOccultedGeneral as PriOG;
+
+// updates.rs
+pub use OpOutcomeThunkGeneric as OOTG;
+pub type PUE = PreparedUpdateEntry;
+pub type PUFOS = PieceUpdateFromOpSimple;
+pub type PUO<NS,ZL> = PieceUpdateOp<NS,ZL>;
+pub type PUOs = PieceUpdateOps;
+pub type WRC = WhatResponseToClientOp;
+#[allow(non_camel_case_types)] pub type PUE_P = PreparedUpdateEntry_Piece;
+
+// utils.rs
+pub use SVGSizeError as SvSE;
// There is NO WARRANTY.
pub use crate::imports::*;
-pub use otter_base::prelude::*;
+pub use crate::prelude_part::*;
-pub use std::any::Any;
-pub use std::borrow::Cow;
-pub use std::cmp::{self, max, min, Ordering};
-pub use std::collections::VecDeque;
-pub use std::collections::{btree_map, BTreeMap};
-pub use std::collections::{btree_set, BTreeSet};
-pub use std::collections::{hash_map, HashMap, HashSet};
-pub use std::convert::{Infallible, TryFrom, TryInto};
-pub use std::env;
-pub use std::error::Error;
-pub use std::ffi::OsStr;
-pub use std::fmt::Formatter;
-pub use std::fmt::Write as _;
-pub use std::fmt::{self, Debug, Display};
-pub use std::fs;
-pub use std::fs::File;
-pub use std::hash::Hash;
-pub use std::io;
-pub use std::io::ErrorKind;
-pub use std::io::{BufRead, BufReader, BufWriter, Read, Write};
-pub use std::iter;
-pub use std::iter::{repeat_with};
-pub use std::marker::PhantomData;
-pub use std::num::{NonZeroUsize, TryFromIntError, Wrapping};
-pub use std::os::linux::fs::MetadataExt as _; // todo why linux for st_mode??
-pub use std::os::unix;
-pub use std::os::unix::ffi::OsStrExt;
-pub use std::os::unix::fs::{MetadataExt, OpenOptionsExt};
-pub use std::os::unix::io::{AsRawFd, IntoRawFd, RawFd};
-pub use std::os::unix::net::UnixStream;
-pub use std::os::unix::process::{CommandExt, ExitStatusExt};
-pub use std::net::{IpAddr, SocketAddr, ToSocketAddrs, Ipv6Addr, Ipv4Addr};
-pub use std::path::PathBuf;
-pub use std::process::{exit, Child, Command, Stdio};
-pub use std::str;
-pub use std::str::FromStr;
-pub use std::string::ParseError;
-pub use std::sync::Arc;
-pub use std::sync::atomic::AtomicBool;
-pub use std::sync::mpsc;
-pub use std::thread::{self, sleep};
-pub use std::time::{self, Duration, Instant};
+pub use otter_base::imports::*;
+pub use otter_base::prelude_part::*;
-pub use anyhow::{anyhow, ensure, Context};
-pub use async_condvar_fair::{Condvar, BatonExt as _};
-pub use arrayvec::ArrayVec;
-pub use boolinator::Boolinator as _;
-pub use byteorder::{BigEndian, LittleEndian, ReadBytesExt, WriteBytesExt};
-pub use cast_trait_object::{dyn_upcast, DynCastExt};
-pub use const_default::ConstDefault;
-pub use delegate::delegate;
-pub use derive_into_owned::IntoOwned;
-pub use derive_more::*;
-pub use digest::Digest;
-pub use downcast_rs::{impl_downcast, Downcast};
-pub use educe::Educe;
-pub use either::{Either, Left, Right};
-pub use enum_dispatch::enum_dispatch;
-pub use enum_map::{Enum, EnumMap};
-pub use fehler::{throw, throws};
-pub use flexi_logger::LogSpecification;
-pub use fs2::FileExt;
-pub use if_chain::if_chain;
-pub use index_vec::{define_index_type, index_vec, IndexSlice, IndexVec};
-pub use itertools::{chain, iproduct, izip, zip_eq, EitherOrBoth, Itertools};
-pub use lazy_regex::regex;
-pub use lazy_static::lazy_static;
-pub use log::{debug, error, info, trace, warn};
-pub use log::{log, log_enabled};
-pub use nix::unistd::{self, Uid};
-pub use nix::sys::time::TimeSpec;
-pub use nix::time::clock_gettime;
-pub use num_derive::{ToPrimitive, FromPrimitive};
-pub use num_traits::{Bounded, FromPrimitive, ToPrimitive};
-pub use ordered_float::OrderedFloat;
-pub use paste::paste;
-pub use percent_encoding::percent_decode_str;
-pub use percent_encoding::utf8_percent_encode;
-pub use percent_encoding::NON_ALPHANUMERIC;
-pub use rand::distributions::Alphanumeric;
-pub use rand::thread_rng;
-pub use rand::Rng;
-pub use rand::prelude::SliceRandom;
-pub use regex::Regex;
-pub use serde::ser::SerializeTuple;
-pub use serde::{de::DeserializeOwned, Deserialize, Serialize};
-pub use serde::de::Error as _;
-pub use serde::{Deserializer, Serializer};
-pub use serde_with::DeserializeFromStr;
-pub use serde_with::SerializeDisplay;
-pub use sha2::{Sha512, Sha512_256};
-pub use slotmap::{dense::DenseSlotMap, SparseSecondaryMap, Key as _};
-pub use strum::{EnumCount, EnumDiscriminants};
-pub use strum::{EnumString, EnumIter, EnumMessage, EnumProperty};
-pub use strum::{AsRefStr, IntoEnumIterator, IntoStaticStr};
-pub use subtle::ConstantTimeEq;
-pub use tempfile::{self, NamedTempFile};
-pub use tera::Tera;
-pub use thiserror::Error;
-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 otter_support::imports::*;
+pub use otter_support::prelude_part::*;
-// No debug version of this
-pub use parking_lot::{RwLock, RwLockReadGuard, RwLockWriteGuard};
-
-// Swap this over for debugging
-pub use parking_lot::{Mutex, MutexGuard};
-//pub use crate::debugmutex::{Mutex, MutexGuard};
-
-use nix::time::ClockId;
-pub const CLOCK_REALTIME : ClockId = ClockId::CLOCK_REALTIME ;
-pub const CLOCK_MONOTONIC: ClockId = ClockId::CLOCK_MONOTONIC;
-
-pub use otter_base::{pos_zip_map, pos_zip_try_map};
-pub use otter_base::geometry::{self,Coord,Pos,PosC,Rect,RectC};
-pub use otter_base::geometry::{CoordinateOverflow,Region};
-pub use otter_base::zcoord::{self, ZCoord};
-pub use otter_base::misc as base_misc;
-pub use otter_base::dbgc;
-pub use base_misc::*;
-
-pub use crate::{deref_to_field, deref_to_field_mut};
-pub use crate::ensure_eq;
-pub use crate::format_by_fmt_hex;
-pub use crate::impl_via_ambassador;
-pub use crate::matches_doesnot;
-pub use crate::trace_dbg;
-pub use crate::{want, wantok, wants, want_let, want_failed_internal};
-pub use crate::serde_with_compat;
-
-pub use crate::accounts::loaded_acl::{self, EffectiveACL, LoadedAcl, PermSet};
-pub use crate::accounts::*;
-pub use crate::authproofs::{self, Authorisation, Unauthorised};
-pub use crate::authproofs::AuthorisationSuperuser;
-pub use crate::asseturl::*;
-pub use crate::bundles::{self, InstanceBundles, MgmtBundleListExt};
-pub use crate::childio;
-pub use crate::commands::{AccessTokenInfo, AccessTokenReport, MgmtError};
-pub use crate::commands::{MgmtCommand, MgmtResponse};
-pub use crate::commands::{MgmtGameInstruction, MgmtGameResponse};
-pub use crate::commands::{MgmtBundleList, MgmtGameUpdateMode};
-pub use crate::commands::{ProgressUpdateMode};
-pub use crate::config::*;
-pub use crate::debugmutex::DebugIdentify;
-pub use crate::debugreader::DebugReader;
-pub use crate::digestrw::{self, *};
-pub use crate::error::*;
-pub use crate::fake_rng::*;
-pub use crate::fake_time::*;
-pub use crate::fastsplit::*;
-pub use crate::gamestate::*;
-pub use crate::global::*;
-pub use crate::hidden::*;
-pub use crate::keydata::*;
-pub use crate::nwtemplates;
-pub use crate::materials_format;
-pub use crate::mgmtchannel::*;
-pub use crate::occultilks::*;
-pub use crate::organise;
-pub use crate::packetframe::{FrameReader, FrameWriter, ReadFrame, WriteFrame};
-pub use crate::packetframe::{ReadExt, ResponseWriter};
-pub use crate::pcaliases::*;
-pub use crate::pcrender::*;
-pub use crate::pieces::*;
-pub use crate::progress::{self, ProgressInfo, OriginatorExt as _};
-pub use crate::shapelib;
-pub use crate::shapelib::{CircleShape, RectShape};
-pub use crate::shapelib::{ItemEnquiryData, LibraryEnquiryData};
-pub use crate::shapelib::{LibraryLoadError};
-pub use crate::slotmap_slot_idx::*;
-pub use crate::spec::*;
-pub use crate::spec::piece_specs::{FaceColourSpecs, SimpleCommon};
-pub use crate::toml_de;
-pub use crate::timedfd::*;
-pub use crate::termprogress;
-pub use crate::tz::*;
-pub use crate::updates::*;
-pub use crate::utils::*;
-pub use crate::ui::*;
-
-pub use crate::gamestate::RefTraitObjectPieceTraitExt as _;
-pub use crate::fastsplit::RefTraitObjectPieceTraitExt as _;
-
-pub type SecondarySlotMap<K,V> = slotmap::secondary::SecondaryMap<K,V>;
-pub type SvgData = Vec<u8>;
-pub type Colour = Html;
-
-pub const MS: time::Duration = time::Duration::from_millis(1);
-
-// ---------- type abbreviations ----------
-
-pub type AE = anyhow::Error;
-
-// accounts.rs
-pub type AS = AccountScope;
-
-// commands.rs
-pub type MC = MgmtCommand;
-pub type ME = MgmtError;
-pub type MGI = MgmtGameInstruction;
-pub type MGR = MgmtGameResponse;
-pub type MR = MgmtResponse;
-pub type PUM = ProgressUpdateMode;
-
-// error.rs
-pub type APOE = ApiPieceOpError;
-pub type ESVU<POEPU,EM> = ErrorSignaledViaUpdate<POEPU,EM>;
-pub type IE = InternalError;
-pub type Ia = Inapplicable;
-pub type POEPP = PieceOpErrorPartiallyProcessed;
-pub type SvgE = SVGProcessingError;
-pub type SpE = SpecError;
-
-// gamestate.rs
-pub use PieceLoadArgs as PLA;
-
-// hidden.rs
-pub type OccK = OccultationKind;
-pub use OccultationKindGeneral as OccKG;
-pub use OccultationKindAlwaysOk as OccKA;
-
-// materials-format.rs
-
-pub use materials_format::VersionError as MFVE;
-
-// occultilks.rs
-pub type LOI = LOccultIlk;
-pub type IOI = IOccultIlk;
-
-// pcrender.rs
-pub use PriOccultedGeneral as PriOG;
-
-// updates.rs
-pub use OpOutcomeThunkGeneric as OOTG;
-pub type PUE = PreparedUpdateEntry;
-pub type PUFOS = PieceUpdateFromOpSimple;
-pub type PUO<NS,ZL> = PieceUpdateOp<NS,ZL>;
-pub type PUOs = PieceUpdateOps;
-pub type WRC = WhatResponseToClientOp;
-#[allow(non_camel_case_types)] pub type PUE_P = PreparedUpdateEntry_Piece;
-
-// utils.rs
-pub use SVGSizeError as SvSE;
// SPDX-License-Identifier: AGPL-3.0-or-later
// There is NO WARRANTY.
-pub use crate::prelude::*;
+use crate::prelude::*;
use shapelib::OutlineDefnEnum;
// SPDX-License-Identifier: AGPL-3.0-or-later
// There is NO WARRANTY.
-pub use crate::prelude::*;
+use crate::prelude::*;
pub use crate::shapelib_toml::*;
+pub use crate::prelude::GoodItemName; // not sure why this is needed
+
use parking_lot::{const_rwlock, RwLock};
use parking_lot::RwLockReadGuard;
//! Provides a [`get_idx_key`](trait.KeyDataExt.html#tymethod.get_idx_version) method on
//! `slotmap::KeyData`. See [KeyDataExt::get_idx_version].
-use otter_base::misc::default;
+use crate::prelude::otter_base::misc::default;
/// Extension trait for `slotmap::KeyData`, providing `get_idx_version`.
///
// game specs
use crate::imports::*;
+use otter_support::imports::*;
+use otter_base::imports::*;
use std::borrow::Cow;
use std::collections::hash_map::HashMap;
// There is NO WARRANTY.
use crate::imports::*;
+use otter_support::imports::*;
+use otter_base::imports::*;
use std::fmt::{Debug, Display};
use std::iter::Peekable;
// SPDX-License-Identifier: AGPL-3.0-or-later
// There is NO WARRANTY.
-use crate::imports::*;
use crate::prelude::*;
+pub use otter_base::imports::extend::ext;
+
//========== miscellany ==========
// (roughly in order of implementation length)
{
#[allow(non_snake_case)]
mod $name_mod {
- use $crate::imports::extend::ext;
+ use $crate::prelude::extend::ext;
use $entry as Entry;
use Entry::{Occupied, Vacant};
#[ext(pub, name=EntryExt)]
--- /dev/null
+# Copyright 2020-2021 Ian Jackson and contributors to Otter
+# SPDX-License-Identifier: AGPL-3.0-or-later
+# There is NO WARRANTY.
+
+[package]
+name="otter-support"
+description="Otter game system; support code Rust crate."
+
+version="1.0.0"
+license="AGPL-3.0-or-later"
+edition="2021"
+resolver="1" # new resolver crashes!
+homepage="https://www.chiark.greenend.org.uk/~ianmdlvl/otter/docs/"
+repository="https://salsa.debian.org/iwj/otter"
+keywords=["games"]
+authors=["Ian Jackson <ijackson@chiark.greenend.org.uk>",
+ "and the contributors to Otter"]
+
+[lib]
+name="otter_support"
+path="lib.rs"
+
+
+[dependencies]
+
+otter-base.path="../base"
+otter-base.version="=1.0.0"
+
+chrono="0.4"
+chrono-tz="0.6"
+fehler="1"
+log="0.4"
+parking_lot="0.12"
+
+serde_with="1"
+
+serde = { version="1" , features=["derive", "rc"] }
+
+#fin.
--- /dev/null
+// Copyright 2020-2021 Ian Jackson and contributors to Otter
+// SPDX-License-Identifier: AGPL-3.0-or-later
+// There is NO WARRANTY.
+
+pub use otter_base;
+
+pub use chrono;
+pub use chrono_tz;
+pub use log;
+pub use parking_lot;
--- /dev/null
+// Copyright 2020-2021 Ian Jackson and contributors to Otter
+// SPDX-License-Identifier: AGPL-3.0-or-later
+// There is NO WARRANTY.
+
+pub mod imports;
+pub mod prelude;
+
+#[path="prelude-part.rs"]
+pub mod prelude_part;
+
+pub mod support;
+
+#[path="../src/tz.rs"] pub mod tz;
--- /dev/null
+// Copyright 2020-2021 Ian Jackson and contributors to Otter
+// SPDX-License-Identifier: AGPL-3.0-or-later
+// There is NO WARRANTY.
+
+pub use std::collections::{hash_map, HashMap, HashSet};
+pub use std::sync::Arc;
+
+pub use log::{debug, error, info, trace, warn};
+pub use serde::ser::SerializeTuple;
+pub use serde::{de::DeserializeOwned, Deserialize, Serialize};
+pub use serde::de::Error as _;
+pub use serde::{Deserializer, Serializer};
+pub use serde_with::DeserializeFromStr;
+pub use serde_with::SerializeDisplay;
+
+// No debug version of this
+pub use parking_lot::{RwLock, RwLockReadGuard, RwLockWriteGuard};
+
+// Swap this over for debugging
+pub use parking_lot::{Mutex, MutexGuard};
+//pub use crate::debugmutex::{Mutex, MutexGuard};
+
+pub use crate::support::*;
+pub use crate::tz::*;
+
--- /dev/null
+// Copyright 2020-2021 Ian Jackson and contributors to Otter
+// SPDX-License-Identifier: AGPL-3.0-or-later
+// There is NO WARRANTY.
+
+pub use crate::imports::*;
+pub use crate::prelude_part::*;
+
+pub use otter_base::imports::*;
+pub use otter_base::prelude_part::*;
+
--- /dev/null
+// Copyright 2020-2021 Ian Jackson and contributors to Otter
+// SPDX-License-Identifier: AGPL-3.0-or-later
+// There is NO WARRANTY.
+
+use crate::prelude::*;
+
+#[derive(Copy,Clone,Debug,Serialize,Deserialize,Eq,Ord,PartialEq,PartialOrd)]
+#[serde(transparent)]
+pub struct Timestamp(pub u64); /* time_t */
+
+impl Timestamp {
+ /// Always >= previously
+ pub fn now() -> Timestamp {
+ use std::time::SystemTime;
+ let now = SystemTime::now()
+ .duration_since(SystemTime::UNIX_EPOCH)
+ .unwrap()
+ .as_secs();
+ Timestamp(now)
+ }
+
+ pub fn render(&self, tz: &Timezone) -> String {
+ tz.format(*self)
+ }
+}
+
+