about summary refs log tree commit diff
path: root/tvix/castore/src/fs/root_nodes.rs
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2024-01-09T09·04+0200
committerclbot <clbot@tvl.fyi>2024-01-09T14·08+0000
commit89882ff9b13ff1c25fc64605e3fc87ae7b9ab877 (patch)
tree4eaf9a8d3214ec8acda1fa5f94c2fc9624438518 /tvix/castore/src/fs/root_nodes.rs
parent8fbdf72825843416dc1923d91cb20059cdbc07b1 (diff)
refactor(tvix): use AsRef<dyn …> instead of Deref<Target= …> r/7359
Removes some more needs for Arcs.

Change-Id: I9a9f4b81641c271de260e9ffa98313a32944d760
Reviewed-on: https://cl.tvl.fyi/c/depot/+/10578
Autosubmit: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
Reviewed-by: raitobezarius <tvl@lahfa.xyz>
Diffstat (limited to 'tvix/castore/src/fs/root_nodes.rs')
-rw-r--r--tvix/castore/src/fs/root_nodes.rs10
1 files changed, 6 insertions, 4 deletions
diff --git a/tvix/castore/src/fs/root_nodes.rs b/tvix/castore/src/fs/root_nodes.rs
index 312a0b2cdd7e..a603fd1b37d5 100644
--- a/tvix/castore/src/fs/root_nodes.rs
+++ b/tvix/castore/src/fs/root_nodes.rs
@@ -1,4 +1,4 @@
-use std::{collections::BTreeMap, ops::Deref, pin::Pin};
+use std::{collections::BTreeMap, pin::Pin};
 
 use crate::{proto::node::Node, Error};
 use bytes::Bytes;
@@ -23,13 +23,15 @@ pub trait RootNodes: Send + Sync {
 /// the key is the node name.
 impl<T> RootNodes for T
 where
-    T: Deref<Target = BTreeMap<Bytes, Node>> + Send + Sync,
+    T: AsRef<BTreeMap<Bytes, Node>> + Send + Sync,
 {
     async fn get_by_basename(&self, name: &[u8]) -> Result<Option<Node>, Error> {
-        Ok(self.get(name).cloned())
+        Ok(self.as_ref().get(name).cloned())
     }
 
     fn list(&self) -> Pin<Box<dyn Stream<Item = Result<Node, Error>> + Send + '_>> {
-        Box::pin(tokio_stream::iter(self.iter().map(|(_, v)| Ok(v.clone()))))
+        Box::pin(tokio_stream::iter(
+            self.as_ref().iter().map(|(_, v)| Ok(v.clone())),
+        ))
     }
 }