From 89882ff9b13ff1c25fc64605e3fc87ae7b9ab877 Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Tue, 9 Jan 2024 11:04:29 +0200 Subject: refactor(tvix): use AsRef instead of Deref MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Removes some more needs for Arcs. Change-Id: I9a9f4b81641c271de260e9ffa98313a32944d760 Reviewed-on: https://cl.tvl.fyi/c/depot/+/10578 Autosubmit: flokli Tested-by: BuildkiteCI Reviewed-by: raitobezarius --- tvix/store/src/pathinfoservice/fs/mod.rs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'tvix/store/src/pathinfoservice') diff --git a/tvix/store/src/pathinfoservice/fs/mod.rs b/tvix/store/src/pathinfoservice/fs/mod.rs index df7a42e91f..b7657d6384 100644 --- a/tvix/store/src/pathinfoservice/fs/mod.rs +++ b/tvix/store/src/pathinfoservice/fs/mod.rs @@ -1,6 +1,5 @@ use futures::Stream; use futures::StreamExt; -use std::ops::Deref; use std::pin::Pin; use tonic::async_trait; use tvix_castore::fs::{RootNodes, TvixStoreFs}; @@ -21,9 +20,9 @@ pub fn make_fs( list_root: bool, ) -> TvixStoreFs> where - BS: Deref + Send + Clone + 'static, - DS: Deref + Send + Clone + 'static, - PS: Deref + Send + Sync + Clone + 'static, + BS: AsRef + Send + Clone + 'static, + DS: AsRef + Send + Clone + 'static, + PS: AsRef + Send + Sync + Clone + 'static, { TvixStoreFs::new( blob_service, @@ -46,7 +45,7 @@ pub struct RootNodesWrapper(pub(crate) T); #[async_trait] impl RootNodes for RootNodesWrapper where - T: Deref + Send + Sync, + T: AsRef + Send + Sync, { async fn get_by_basename(&self, name: &[u8]) -> Result, Error> { let Ok(store_path) = nix_compat::store_path::StorePath::from_bytes(name) else { @@ -55,7 +54,7 @@ where Ok(self .0 - .deref() + .as_ref() .get(*store_path.digest()) .await? .map(|path_info| { @@ -68,7 +67,7 @@ where } fn list(&self) -> Pin> + Send>> { - Box::pin(self.0.deref().list().map(|result| { + Box::pin(self.0.as_ref().list().map(|result| { result.map(|path_info| { path_info .node -- cgit 1.4.1