Box<[u8]> instead of Vec<u8> for ByteBufOwned

This commit is contained in:
Igor Katson 2024-03-29 11:00:58 +00:00
parent d9ec702f59
commit deee41cd93
No known key found for this signature in database
GPG key ID: B4EC22B66D61A3F5
23 changed files with 106 additions and 124 deletions

View file

@ -2,7 +2,7 @@ use std::{iter::once, path::PathBuf};
use anyhow::Context;
use bencode::BencodeDeserializer;
use buffers::{ByteBuf, ByteString};
use buffers::{ByteBuf, ByteBufOwned};
use clone_to_owned::CloneToOwned;
use itertools::Either;
use serde::{Deserialize, Serialize};
@ -10,7 +10,7 @@ use serde::{Deserialize, Serialize};
use crate::hash_id::Id20;
pub type TorrentMetaV1Borrowed<'a> = TorrentMetaV1<ByteBuf<'a>>;
pub type TorrentMetaV1Owned = TorrentMetaV1<ByteString>;
pub type TorrentMetaV1Owned = TorrentMetaV1<ByteBufOwned>;
/// Parse torrent metainfo from bytes.
pub fn torrent_from_bytes<'de, ByteBuf: Deserialize<'de>>(