Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@
.claude
.serena/
node_modules
/tests/large_files/
22 changes: 21 additions & 1 deletion crates/clone_to_owned/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// but to have one-line conversion for it into TorrentMetaInfo<Vec<u8>> so that we can store it later somewhere.

use bytes::Bytes;
use std::collections::HashMap;
use std::collections::{BTreeMap, HashMap};

pub trait CloneToOwned {
type Target;
Expand Down Expand Up @@ -74,3 +74,23 @@ where
result
}
}

impl<K, V> CloneToOwned for BTreeMap<K, V>
where
K: CloneToOwned,
<K as CloneToOwned>::Target: Ord,
V: CloneToOwned,
{
type Target = BTreeMap<<K as CloneToOwned>::Target, <V as CloneToOwned>::Target>;

fn clone_to_owned(&self, within_buffer: Option<&Bytes>) -> Self::Target {
self.iter()
.map(|(k, v)| {
(
k.clone_to_owned(within_buffer),
v.clone_to_owned(within_buffer),
)
})
.collect()
}
}
2 changes: 1 addition & 1 deletion crates/librqbit/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ windows = { workspace = true, features = ["Win32", "Win32_System", "Win32_System
anyhow.workspace = true

[dev-dependencies]
tracing-subscriber.workspace = true
tracing-subscriber = { workspace = true, features = ["fmt", "std"] }
tokio-test.workspace = true
tempfile.workspace = true
pollster.workspace = true
Expand Down
Loading