1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
use git_hash::ObjectId;
use crate::data::output::Count;
#[derive(PartialEq, Eq, Debug, Hash, Ord, PartialOrd, Clone)]
#[cfg_attr(feature = "serde1", derive(serde::Serialize, serde::Deserialize))]
pub enum PackLocation {
NotLookedUp,
LookedUp(Option<crate::data::entry::Location>),
}
impl PackLocation {
pub fn is_none(&self) -> bool {
match self {
PackLocation::LookedUp(opt) => opt.is_none(),
PackLocation::NotLookedUp => unreachable!("must have been resolved"),
}
}
pub fn as_ref(&self) -> Option<&crate::data::entry::Location> {
match self {
PackLocation::LookedUp(opt) => opt.as_ref(),
PackLocation::NotLookedUp => unreachable!("must have been resolved"),
}
}
}
impl Count {
pub fn from_data(oid: impl Into<ObjectId>, location: Option<crate::data::entry::Location>) -> Self {
Count {
id: oid.into(),
entry_pack_location: PackLocation::LookedUp(location),
}
}
}
#[path = "objects/mod.rs"]
mod objects_impl;
pub use objects_impl::{objects, objects_unthreaded};
pub mod objects {
pub use super::objects_impl::{Error, ObjectExpansion, Options, Outcome, Result};
}