From 6005491cd8adf569c0b7f88fc6b3af3f166963ea Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Thu, 27 Apr 2023 16:14:44 +0200 Subject: Use Cow<[u8]> for sort keys --- src/table/util.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/table/util.rs') diff --git a/src/table/util.rs b/src/table/util.rs index 0b10cf3f..39412c79 100644 --- a/src/table/util.rs +++ b/src/table/util.rs @@ -1,3 +1,5 @@ +use std::borrow::Cow; + use serde::{Deserialize, Serialize}; use garage_util::data::*; @@ -7,8 +9,8 @@ use crate::schema::*; #[derive(Clone, PartialEq, Eq, Serialize, Deserialize)] pub struct EmptyKey; impl SortKey for EmptyKey { - fn sort_key(&self) -> &[u8] { - &[] + fn sort_key(&self) -> Cow<'_, [u8]> { + Cow::from(&[][..]) } } impl PartitionKey for EmptyKey { -- cgit v1.2.3