git_pack/
find.rs

1///
2pub mod existing {
3    use git_hash::ObjectId;
4
5    /// The error returned by the [`find(…)`][crate::FindExt::find()] trait methods.
6    #[derive(Debug, thiserror::Error)]
7    #[allow(missing_docs)]
8    pub enum Error<T: std::error::Error + 'static> {
9        #[error(transparent)]
10        Find(T),
11        #[error("An object with id {} could not be found", .oid)]
12        NotFound { oid: ObjectId },
13    }
14}
15
16///
17pub mod existing_object {
18    use git_hash::ObjectId;
19
20    /// The error returned by the various [`find_*`][crate::FindExt::find_commit()] trait methods.
21    #[derive(Debug, thiserror::Error)]
22    #[allow(missing_docs)]
23    pub enum Error<T: std::error::Error + 'static> {
24        #[error(transparent)]
25        Find(T),
26        #[error(transparent)]
27        Decode(git_object::decode::Error),
28        #[error("An object with id {} could not be found", .oid)]
29        NotFound { oid: ObjectId },
30        #[error("Expected object of kind {} something else", .expected)]
31        ObjectKind { expected: git_object::Kind },
32    }
33}
34
35///
36pub mod existing_iter {
37    use git_hash::ObjectId;
38
39    /// The error returned by the various [`find_*`][crate::FindExt::find_commit()] trait methods.
40    #[derive(Debug, thiserror::Error)]
41    #[allow(missing_docs)]
42    pub enum Error<T: std::error::Error + 'static> {
43        #[error(transparent)]
44        Find(T),
45        #[error("An object with id {} could not be found", .oid)]
46        NotFound { oid: ObjectId },
47        #[error("Expected object of kind {} something else", .expected)]
48        ObjectKind { expected: git_object::Kind },
49    }
50}
51
52/// An Entry in a pack providing access to its data.
53///
54/// Its commonly retrieved by reading from a pack index file followed by a read from a pack data file.
55#[derive(PartialEq, Eq, Debug, Hash, Ord, PartialOrd, Clone)]
56#[cfg_attr(feature = "serde1", derive(serde::Serialize, serde::Deserialize))]
57#[allow(missing_docs)]
58pub struct Entry {
59    /// The pack-data encoded bytes of the pack data entry as present in the pack file, including the header followed by compressed data.
60    pub data: Vec<u8>,
61    /// The version of the pack file containing `data`
62    pub version: crate::data::Version,
63}