#[non_exhaustive]pub struct PeelError {
pub original: ObjectId,
pub id: ObjectId,
pub from: Option<ObjectId>,
pub depth: usize,
pub source: Box<PeelFailure>,
}Expand description
A failed read-only resolution, with the exact link being examined.
Use the original tip, failing ID, parent tag and depth together when reporting a failed chain. No partial successful target is returned. Inspect the source category before deciding whether storage recovery, a larger budget, or cancellation policy applies.
use girt::{InitKind, ObjectFormat, ObjectId, PackLimits, PeelFailure, PeelLimits, Repository};
let directory = tempfile::tempdir()?;
let repo = Repository::init(
ObjectFormat::Sha1,
directory.path().join("r.git"),
InitKind::Bare,
)?;
let objects = repo.objects_with(PackLimits::default())?;
let missing = ObjectId::Sha1([1; 20]);
let error = objects
.peel(
missing,
PeelLimits::default(),
&std::sync::atomic::AtomicBool::new(false),
)
.expect_err("not stored");
assert_eq!(error.id, missing);
assert!(matches!(error.source.as_ref(), PeelFailure::Missing));Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.original: ObjectIdOriginal requested tip.
id: ObjectIdObject whose read or interpretation failed, or the next object at cancellation/cycle.
from: Option<ObjectId>Tag declaring this target; absent while examining the original tip.
depth: usizeNumber of tag edges already followed.
source: Box<PeelFailure>Structured reason for failure.
Trait Implementations§
Source§impl Error for PeelError
impl Error for PeelError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
Source§impl From<PeelError> for FetchUpdateError
impl From<PeelError> for FetchUpdateError
Auto Trait Implementations§
impl !RefUnwindSafe for PeelError
impl !UnwindSafe for PeelError
impl Freeze for PeelError
impl Send for PeelError
impl Sync for PeelError
impl Unpin for PeelError
impl UnsafeUnpin for PeelError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more