mirror of
https://github.com/rustic-rs/rustic.git
synced 2025-10-26 11:18:51 +00:00
Merge pull request #260 from rustic-rs/remove-ambassador
Remove dependency on ambassador
This commit is contained in:
commit
db34cb1af8
12
Cargo.lock
generated
12
Cargo.lock
generated
@ -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",
|
||||
|
||||
@ -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"
|
||||
|
||||
@ -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<IndexEntry>;
|
||||
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: DecryptReadBackend> {
|
||||
be: BE,
|
||||
index: Arc<Index>,
|
||||
}
|
||||
|
||||
impl<BE: DecryptReadBackend> ReadIndex for IndexBackend<BE> {
|
||||
fn get_id(&self, tpe: &BlobType, id: &Id) -> Option<IndexEntry> {
|
||||
self.index.get_id(tpe, id)
|
||||
}
|
||||
|
||||
fn total_size(&self, tpe: &BlobType) -> u64 {
|
||||
self.index.total_size(tpe)
|
||||
}
|
||||
}
|
||||
|
||||
impl<BE: DecryptReadBackend> IndexBackend<BE> {
|
||||
pub fn new_from_index(be: &BE, index: Index) -> Self {
|
||||
Self {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user