1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
use std::sync::Arc;
use git_features::threading::OwnShared;
use crate::{linked, Cache};
impl linked::Store {
/// Create a store handle with a shared reference to this instance.
pub fn to_cache(&self) -> Cache<&Self> {
self.into()
}
/// Create a store handle with a shared reference to this instance, if this instance is kept in an Arc.
pub fn to_cache_arc(self: &Arc<Self>) -> Cache<Arc<Self>> {
Arc::clone(self).into()
}
/// Create a store handle with a shared reference to this instance, if this instance is kept in an Rc/Arc.
///
/// The latter depends on the `git-features/parallel` feature toggle.
pub fn to_cache_shared(self: &OwnShared<Self>) -> Cache<OwnShared<Self>> {
OwnShared::clone(self).into()
}
}