Trait git_odb::Find

source ·
pub trait Find {
    type Error: Error + 'static;

    // Required methods
    fn contains(&self, id: impl AsRef<oid>) -> bool;
    fn try_find<'a>(
        &self,
        id: impl AsRef<oid>,
        buffer: &'a mut Vec<u8>
    ) -> Result<Option<Data<'a>>, Self::Error>;
}
Expand description

Describe how object can be located in an object store.

Notes

Find effectively needs generic associated types to allow a trait for the returned object type. Until then, we will have to make due with explicit types and give them the potentially added features we want.

Required Associated Types§

source

type Error: Error + 'static

The error returned by try_find()

Required Methods§

source

fn contains(&self, id: impl AsRef<oid>) -> bool

Returns true if the object exists in the database.

source

fn try_find<'a>( &self, id: impl AsRef<oid>, buffer: &'a mut Vec<u8> ) -> Result<Option<Data<'a>>, Self::Error>

Find an object matching id in the database while placing its raw, possibly encoded data into buffer.

Returns Some object if it was present in the database, or the error that occurred during lookup or object retrieval.

Implementations on Foreign Types§

source§

impl<T> Find for Rc<T>where T: Find,

§

type Error = <T as Find>::Error

source§

fn contains(&self, id: impl AsRef<oid>) -> bool

source§

fn try_find<'a>( &self, id: impl AsRef<oid>, buffer: &'a mut Vec<u8> ) -> Result<Option<Data<'a>>, Self::Error>

source§

impl<T> Find for &Twhere T: Find,

§

type Error = <T as Find>::Error

source§

fn contains(&self, id: impl AsRef<oid>) -> bool

source§

fn try_find<'a>( &self, id: impl AsRef<oid>, buffer: &'a mut Vec<u8> ) -> Result<Option<Data<'a>>, Self::Error>

source§

impl<T> Find for Arc<T>where T: Find,

§

type Error = <T as Find>::Error

source§

fn contains(&self, id: impl AsRef<oid>) -> bool

source§

fn try_find<'a>( &self, id: impl AsRef<oid>, buffer: &'a mut Vec<u8> ) -> Result<Option<Data<'a>>, Self::Error>

Implementors§

source§

impl<S> Find for Handle<S>where S: Deref<Target = Store> + Clone, Self: Find,

§

type Error = <Handle<S> as Find>::Error

source§

impl<S> Find for Cache<S>where S: Find,

§

type Error = <S as Find>::Error