From 0f368f0b48b6830451948bcf5d991cb37e0fd7a7 Mon Sep 17 00:00:00 2001 From: Julien Cretin Date: Fri, 3 Jun 2022 17:03:06 +0200 Subject: [PATCH] Add justification for Cow usage --- libraries/persistent_store/src/storage.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libraries/persistent_store/src/storage.rs b/libraries/persistent_store/src/storage.rs index adc3c53..696c258 100644 --- a/libraries/persistent_store/src/storage.rs +++ b/libraries/persistent_store/src/storage.rs @@ -62,6 +62,9 @@ pub trait Storage { /// Reads a byte slice from the storage. /// /// The `index` must designate `length` bytes in the storage. + /// + /// Note that we use `Cow` just because it derefs to `[u8]`. We don't really need the fact that + /// one can convert it to a `Vec`. In particular we don't do it in the store implementation. fn read_slice(&self, index: StorageIndex, length: usize) -> StorageResult>; /// Writes a word slice to the storage.