A few renames in generics

This commit is contained in:
Igor Katson 2024-05-02 09:46:56 +01:00
parent 9bcd18e7af
commit f0b63b5926
2 changed files with 4 additions and 4 deletions

View file

@ -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 })
}
}

View file

@ -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)
}