cleanup a little
This commit is contained in:
parent
0ceb55546b
commit
86003436a6
13 changed files with 4 additions and 70 deletions
|
@ -41,3 +41,4 @@ bytesize = { version = "2.0.1", features = ["serde"] }
|
||||||
bytes = { version = "1.10.1", features = ["serde"] }
|
bytes = { version = "1.10.1", features = ["serde"] }
|
||||||
url = { version = "2.5.4", features = ["serde"] }
|
url = { version = "2.5.4", features = ["serde"] }
|
||||||
blake3 = "1.8.2"
|
blake3 = "1.8.2"
|
||||||
|
slotmap = { version = "1.0.7", features = ["serde"] }
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
pub mod dict;
|
|
|
@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -23,7 +23,7 @@ macro_rules! _combined {
|
||||||
impl $name {
|
impl $name {
|
||||||
pub fn transmogrify<T>(self) -> T
|
pub fn transmogrify<T>(self) -> T
|
||||||
where
|
where
|
||||||
T: $crate::Anything $(+ std::convert::From<$ty>)*
|
T: $crate::generic::Anything $(+ std::convert::From<$ty>)*
|
||||||
{
|
{
|
||||||
match self {$(
|
match self {$(
|
||||||
Self::$VarName(v) => v.into()
|
Self::$VarName(v) => v.into()
|
||||||
|
|
|
@ -1,13 +0,0 @@
|
||||||
use crate::data;
|
|
||||||
|
|
||||||
#[data(copy, ord, crate = crate)]
|
|
||||||
pub struct AndThen<L, R> {
|
|
||||||
pub lhs: L,
|
|
||||||
pub rhs: R,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<L, R> AndThen<L, R> {
|
|
||||||
pub const fn new(lhs: L, rhs: R) -> Self {
|
|
||||||
Self { lhs, rhs }
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,8 +1,7 @@
|
||||||
use crate::{auto_impl, fut::Fut};
|
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 apply;
|
||||||
mod then;
|
mod then;
|
||||||
|
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
|
|
10
src/lib.rs
10
src/lib.rs
|
@ -13,10 +13,6 @@ macro_rules! zst_error {
|
||||||
}};
|
}};
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The trait that is implemented for everything.
|
|
||||||
pub trait Anything {}
|
|
||||||
impl<T: ?Sized> Anything for T {}
|
|
||||||
|
|
||||||
pub use bytes;
|
pub use bytes;
|
||||||
pub use bytesize;
|
pub use bytesize;
|
||||||
pub use url;
|
pub use url;
|
||||||
|
@ -26,6 +22,7 @@ pub use seq_macro::seq;
|
||||||
|
|
||||||
pub use auto_impl::auto_impl;
|
pub use auto_impl::auto_impl;
|
||||||
pub use perfect_derive::perfect_derive;
|
pub use perfect_derive::perfect_derive;
|
||||||
|
pub use slotmap;
|
||||||
pub use trait_set::trait_set;
|
pub use trait_set::trait_set;
|
||||||
|
|
||||||
pub mod array;
|
pub mod array;
|
||||||
|
@ -34,14 +31,9 @@ pub mod error;
|
||||||
pub mod fut;
|
pub mod fut;
|
||||||
pub mod time;
|
pub mod time;
|
||||||
|
|
||||||
pub mod sync;
|
|
||||||
pub mod trace_id;
|
|
||||||
|
|
||||||
pub mod generic;
|
pub mod generic;
|
||||||
pub mod slab;
|
|
||||||
pub mod str;
|
pub mod str;
|
||||||
|
|
||||||
pub mod encoding;
|
|
||||||
pub mod rand;
|
pub mod rand;
|
||||||
|
|
||||||
pub mod collections;
|
pub mod collections;
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
|
|
|
@ -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)
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Add table
Add a link
Reference in a new issue