summaryrefslogtreecommitdiff
path: root/src/util/buffer.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2023-02-23 12:15:38 +0100
committerLaurenz <laurmaedje@gmail.com>2023-02-23 12:20:47 +0100
commita1d47695a2af5afa466c21ad812a1a8212780293 (patch)
treea3210a23abbecaf69479f1da8772e4e3f7cce32d /src/util/buffer.rs
parent6e65ebf23641a755b0088569751c0b02e898f1e9 (diff)
Switch to ecow
Diffstat (limited to 'src/util/buffer.rs')
-rw-r--r--src/util/buffer.rs12
1 files changed, 3 insertions, 9 deletions
diff --git a/src/util/buffer.rs b/src/util/buffer.rs
index 766b2084..da12b6cb 100644
--- a/src/util/buffer.rs
+++ b/src/util/buffer.rs
@@ -6,7 +6,7 @@ use comemo::Prehashed;
/// A shared buffer that is cheap to clone and hash.
#[derive(Clone, Hash, Eq, PartialEq)]
-pub struct Buffer(Prehashed<Arc<Vec<u8>>>);
+pub struct Buffer(Arc<Prehashed<Vec<u8>>>);
impl Buffer {
/// Return a view into the buffer.
@@ -22,19 +22,13 @@ impl Buffer {
impl From<&[u8]> for Buffer {
fn from(slice: &[u8]) -> Self {
- Self(Prehashed::new(Arc::new(slice.to_vec())))
+ Self(Arc::new(Prehashed::new(slice.to_vec())))
}
}
impl From<Vec<u8>> for Buffer {
fn from(vec: Vec<u8>) -> Self {
- Self(Prehashed::new(Arc::new(vec)))
- }
-}
-
-impl From<Arc<Vec<u8>>> for Buffer {
- fn from(arc: Arc<Vec<u8>>) -> Self {
- Self(Prehashed::new(arc))
+ Self(Arc::new(Prehashed::new(vec)))
}
}