diff --git a/Cargo.lock b/Cargo.lock index 5cb1526..17ff5e2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -53,17 +53,6 @@ dependencies = [ "memchr", ] -[[package]] -name = "ambassador" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61874b33258f18ca7923047c12887078ccfe95c2811b03c1a09e309c19b7e50b" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "android_system_properties" version = "0.1.5" @@ -1571,7 +1560,6 @@ name = "rustic-rs" version = "0.3.2-dev" dependencies = [ "aes256ctr_poly1305aes", - "ambassador", "anyhow", "async-recursion", "async-trait", diff --git a/Cargo.toml b/Cargo.toml index 5ca48e9..03f1915 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -26,7 +26,6 @@ strip = true async-trait = "0.1" async-recursion = "1" anyhow = "1" -ambassador = "0.2" thiserror = "1" derive_more = "0.99" derivative = "2" diff --git a/src/index/mod.rs b/src/index/mod.rs index 5673a43..058ef98 100644 --- a/src/index/mod.rs +++ b/src/index/mod.rs @@ -1,7 +1,6 @@ use std::num::NonZeroU32; use std::sync::Arc; -use ambassador::{delegatable_trait, Delegate}; use anyhow::{anyhow, Result}; use async_trait::async_trait; use bytes::Bytes; @@ -64,7 +63,6 @@ impl IndexEntry { } } -#[delegatable_trait] pub trait ReadIndex { fn get_id(&self, tpe: &BlobType, id: &Id) -> Option; fn total_size(&self, tpe: &BlobType) -> u64; @@ -104,13 +102,22 @@ pub trait IndexedBackend: ReadIndex + Clone + Sync + Send + 'static { } } -#[derive(Clone, Delegate)] -#[delegate(ReadIndex, target = "index")] +#[derive(Clone)] pub struct IndexBackend { be: BE, index: Arc, } +impl ReadIndex for IndexBackend { + fn get_id(&self, tpe: &BlobType, id: &Id) -> Option { + self.index.get_id(tpe, id) + } + + fn total_size(&self, tpe: &BlobType) -> u64 { + self.index.total_size(tpe) + } +} + impl IndexBackend { pub fn new_from_index(be: &BE, index: Index) -> Self { Self {