refactor(tvix): use AsRef<dyn …> instead of Deref<Target= …>
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>
This commit is contained in:
parent
8fbdf72825
commit
89882ff9b1
8 changed files with 58 additions and 69 deletions
|
|
@ -7,7 +7,6 @@ use crate::proto::DirectoryNode;
|
|||
use crate::proto::FileNode;
|
||||
use crate::proto::SymlinkNode;
|
||||
use crate::Error as CastoreError;
|
||||
use std::ops::Deref;
|
||||
use std::os::unix::ffi::OsStrExt;
|
||||
use std::{
|
||||
collections::HashMap,
|
||||
|
|
@ -68,7 +67,7 @@ async fn process_entry<'a, BS>(
|
|||
maybe_directory: Option<Directory>,
|
||||
) -> Result<Node, Error>
|
||||
where
|
||||
BS: Deref<Target = dyn BlobService> + Clone,
|
||||
BS: AsRef<dyn BlobService> + Clone,
|
||||
{
|
||||
let file_type = entry.file_type();
|
||||
|
||||
|
|
@ -114,7 +113,7 @@ where
|
|||
.await
|
||||
.map_err(|e| Error::UnableToOpen(entry.path().to_path_buf(), e))?;
|
||||
|
||||
let mut writer = blob_service.open_write().await;
|
||||
let mut writer = blob_service.as_ref().open_write().await;
|
||||
|
||||
if let Err(e) = tokio::io::copy(&mut file, &mut writer).await {
|
||||
return Err(Error::UnableToRead(entry.path().to_path_buf(), e));
|
||||
|
|
@ -156,12 +155,12 @@ pub async fn ingest_path<'a, BS, DS, P>(
|
|||
) -> Result<Node, Error>
|
||||
where
|
||||
P: AsRef<Path> + Debug,
|
||||
BS: Deref<Target = dyn BlobService> + Clone,
|
||||
DS: Deref<Target = &'a dyn DirectoryService>,
|
||||
BS: AsRef<dyn BlobService> + Clone,
|
||||
DS: AsRef<dyn DirectoryService>,
|
||||
{
|
||||
let mut directories: HashMap<PathBuf, Directory> = HashMap::default();
|
||||
|
||||
let mut directory_putter = directory_service.put_multiple_start();
|
||||
let mut directory_putter = directory_service.as_ref().put_multiple_start();
|
||||
|
||||
for entry in WalkDir::new(p.as_ref())
|
||||
.follow_links(false)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue