diff --git a/Cargo.toml b/Cargo.toml index 3f29f09..8b1511f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -41,3 +41,4 @@ bytesize = { version = "2.0.1", features = ["serde"] } bytes = { version = "1.10.1", features = ["serde"] } url = { version = "2.5.4", features = ["serde"] } blake3 = "1.8.2" +slotmap = { version = "1.0.7", features = ["serde"] } diff --git a/src/encoding.rs b/src/encoding.rs deleted file mode 100644 index f67cf6d..0000000 --- a/src/encoding.rs +++ /dev/null @@ -1 +0,0 @@ -pub mod dict; diff --git a/src/encoding/dict.rs b/src/encoding/dict.rs deleted file mode 100644 index f6ddf69..0000000 --- a/src/encoding/dict.rs +++ /dev/null @@ -1,28 +0,0 @@ -use crate::data; - -#[data(copy, ord, not(serde), crate = crate)] -pub struct Dict<'a, T>(pub &'a [T]); - -impl<'a, T> Dict<'a, T> { - pub const fn get_encoded_size(&self, of: u64) -> usize { - if of == 0 { - 1 - } else { - of.ilog(self.0.len() as u64) as usize - } - } - - pub fn encode(&self, mut value: u64, mut put: impl FnMut(&T)) { - let base = self.0.len() as u64; - loop { - let rem = value % base; - value /= base; - let idx = rem as usize; - put(&self.0[idx]); - - if value == 0 { - break; - } - } - } -} diff --git a/src/error.rs b/src/error.rs index 7fee5b6..16590bf 100644 --- a/src/error.rs +++ b/src/error.rs @@ -23,7 +23,7 @@ macro_rules! _combined { impl $name { pub fn transmogrify(self) -> T where - T: $crate::Anything $(+ std::convert::From<$ty>)* + T: $crate::generic::Anything $(+ std::convert::From<$ty>)* { match self {$( Self::$VarName(v) => v.into() diff --git a/src/handling/and_then.rs b/src/handling/and_then.rs deleted file mode 100644 index bdcf668..0000000 --- a/src/handling/and_then.rs +++ /dev/null @@ -1,13 +0,0 @@ -use crate::data; - -#[data(copy, ord, crate = crate)] -pub struct AndThen { - pub lhs: L, - pub rhs: R, -} - -impl AndThen { - pub const fn new(lhs: L, rhs: R) -> Self { - Self { lhs, rhs } - } -} diff --git a/src/handling/mod.rs b/src/handling/mod.rs index f16ee56..15aaa87 100644 --- a/src/handling/mod.rs +++ b/src/handling/mod.rs @@ -1,8 +1,7 @@ use crate::{auto_impl, fut::Fut}; -pub use self::{and_then::AndThen, apply::Apply, then::Then}; +pub use self::{apply::Apply, then::Then}; -mod and_then; mod apply; mod then; diff --git a/src/handling/provide_state.rs b/src/handling/provide_state.rs deleted file mode 100644 index 8b13789..0000000 --- a/src/handling/provide_state.rs +++ /dev/null @@ -1 +0,0 @@ - diff --git a/src/hash.rs b/src/hash/mod.rs similarity index 100% rename from src/hash.rs rename to src/hash/mod.rs diff --git a/src/lib.rs b/src/lib.rs index 8ce8ce8..9c39b6e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -13,10 +13,6 @@ macro_rules! zst_error { }}; } -/// The trait that is implemented for everything. -pub trait Anything {} -impl Anything for T {} - pub use bytes; pub use bytesize; pub use url; @@ -26,6 +22,7 @@ pub use seq_macro::seq; pub use auto_impl::auto_impl; pub use perfect_derive::perfect_derive; +pub use slotmap; pub use trait_set::trait_set; pub mod array; @@ -34,14 +31,9 @@ pub mod error; pub mod fut; pub mod time; -pub mod sync; -pub mod trace_id; - pub mod generic; -pub mod slab; pub mod str; -pub mod encoding; pub mod rand; pub mod collections; diff --git a/src/slab.rs b/src/slab.rs deleted file mode 100644 index 8b13789..0000000 --- a/src/slab.rs +++ /dev/null @@ -1 +0,0 @@ - diff --git a/src/str.rs b/src/str/mod.rs similarity index 100% rename from src/str.rs rename to src/str/mod.rs diff --git a/src/sync.rs b/src/sync.rs deleted file mode 100644 index 8b13789..0000000 --- a/src/sync.rs +++ /dev/null @@ -1 +0,0 @@ - diff --git a/src/trace_id.rs b/src/trace_id.rs deleted file mode 100644 index e7cfcf5..0000000 --- a/src/trace_id.rs +++ /dev/null @@ -1,13 +0,0 @@ -use crate::data; - -#[data(copy, ord, display("{_0:X}"), crate = crate)] -#[derive(Hash)] -pub struct TraceId(u128); - -impl TraceId { - pub const fn from_parts(millis: u64, random: u128) -> Self { - let mut result = random & ((1 << 80) - 1); - result |= (millis as u128) << 80; - Self(result) - } -}