A few renames in generics
This commit is contained in:
parent
9bcd18e7af
commit
f0b63b5926
2 changed files with 4 additions and 4 deletions
|
|
@ -22,11 +22,11 @@ pub trait StorageFactoryExt {
|
|||
|
||||
impl<SF: StorageFactory> StorageFactoryExt for SF {
|
||||
fn boxed(self) -> BoxStorageFactory {
|
||||
struct BoxFactory<SF> {
|
||||
struct Wrapper<SF> {
|
||||
sf: SF,
|
||||
}
|
||||
|
||||
impl<SF: StorageFactory> StorageFactory for BoxFactory<SF> {
|
||||
impl<SF: StorageFactory> StorageFactory for Wrapper<SF> {
|
||||
type Storage = Box<dyn TorrentStorage>;
|
||||
|
||||
fn init_storage(&self, info: &ManagedTorrentInfo) -> anyhow::Result<Self::Storage> {
|
||||
|
|
@ -35,7 +35,7 @@ impl<SF: StorageFactory> StorageFactoryExt for SF {
|
|||
}
|
||||
}
|
||||
|
||||
Box::new(BoxFactory { sf: self })
|
||||
Box::new(Wrapper { sf: self })
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
use std::time::Duration;
|
||||
|
||||
use rand::Rng;
|
||||
use rand_distr::Distribution;
|
||||
|
||||
use super::{StorageFactory, TorrentStorage};
|
||||
|
|
@ -44,6 +43,7 @@ fn random_duration() -> Duration {
|
|||
let micros = 340f64 + sl * 200.;
|
||||
// 16 is max blocking threads
|
||||
let micros = micros.max(0.001) * 4. * 16.;
|
||||
#[allow(clippy::cast_possible_truncation)]
|
||||
Duration::from_micros(micros as u64)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue