clone-session-service-objects
Avril 4 years ago
parent ccaaba66d6
commit 98fdc1890d
Signed by: flanchan
GPG Key ID: 284488987C31F630

10
Cargo.lock generated

@ -1028,6 +1028,15 @@ version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8"
[[package]]
name = "smallvec"
version = "1.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1a55ca5f3b68e41c979bf8c46a6f1da892ca4db8f94023ce0bd32407573b1ac0"
dependencies = [
"serde",
]
[[package]]
name = "socket2"
version = "0.3.19"
@ -1393,6 +1402,7 @@ dependencies = [
"difference",
"futures",
"serde",
"smallvec",
"tokio",
"warp",
]

@ -5,9 +5,15 @@ version = "0.1.0"
authors = ["Avril <flanchan@cumallover.me>"]
edition = "2018"
[features]
default = ["nightly"]
nightly = ["smallvec/const_generics"]
[dependencies]
difference = "2.0.0"
futures = "0.3.8"
serde = {version = "1.0.118", features=["derive"]}
smallvec = {version = "1.6.0", features= ["union", "serde", "write"]}
tokio = {version = "0.2", features=["full"] }
warp = "0.2.5"

@ -160,7 +160,7 @@ impl Delta
},
DeltaKind::Clear => inserter.clear(),
DeltaKind::Truncate => inserter.truncate(self.location),
DeltaKind::Shift => ((),inserter.drain(..self.location)).0,
DeltaKind::Shift => drop(inserter.drain(..self.location)),
}
}
}

@ -4,6 +4,7 @@ use std::{
fmt,
ops,
};
use smallvec::SmallVec;
/// Wrapper to derive debug for types that don't implement it.
#[repr(transparent)]
@ -83,6 +84,15 @@ impl<T> BackInserter<T> for Vec<T>
}
}
impl<T> BackInserter<T> for SmallVec<T>
where T: smallvec::Array<Item = T>
{
#[inline] fn push_back(&mut self, value: T)
{
self.push(value)
}
}
/// Absracts a closure for `BackInserter<T>`.
pub struct BackInsertPass<T,F>(F, PhantomData<T>)
where F: FnMut(T);
@ -140,6 +150,14 @@ where T: BackInserter<T>
}
}
impl<T> BackInserter<T> for Option<T>
{
fn push_back(&mut self, value: T)
{
*self = Some(value);
}
}
pub trait VecExt<T>
{
/// Insert many elements with exact size iterator
@ -290,7 +308,7 @@ mod tests
assert_eq!(&vec[..], &vec2[..]);
}
#[cfg(nightly)]
#[cfg(feature="nightly")]
mod benchmatks
{
use super::super::*;

@ -1,6 +1,8 @@
#![cfg_attr(feature="nightly", feature(test))]
#![allow(dead_code)]
#[cfg(all(feature="nightly", test))] extern crate test;
#[macro_use] extern crate serde;
#[macro_use] mod ext; use ext::*;

Loading…
Cancel
Save