pub enum HashError {
InvalidLength {
operation: &'static str,
kind: HashKind,
expected: usize,
actual: usize,
},
InvalidHex {
operation: &'static str,
kind: HashKind,
expected: usize,
actual: usize,
source: FromHexError,
},
KindMismatch {
operation: &'static str,
expected: HashKind,
actual: HashKind,
expected_len: usize,
actual_len: usize,
},
UnknownKind {
operation: &'static str,
tag: String,
expected_tags: &'static str,
expected_tag_lens: &'static str,
actual: usize,
hex_len: usize,
},
UnsupportedObjectType {
operation: &'static str,
kind: HashKind,
object_type: ObjectType,
expected: usize,
actual: usize,
payload_len: usize,
},
Io {
operation: &'static str,
kind: HashKind,
expected: usize,
actual: usize,
error_kind: ErrorKind,
message: String,
},
}Expand description
Errors produced by the explicit-kind ObjectHash constructors and parsers.
Every variant records the operation that failed and the expected/actual
lengths involved; the requested HashKind is recorded on every variant
where it can be determined (HashError::UnknownKind is precisely the case
where the tag did not resolve to one). None of these paths fall back to
another algorithm.
Variants§
InvalidLength
The raw byte slice, hex string or stream does not have the length required by kind.
Fields
InvalidHex
The hex string has the right length but contains characters outside [0-9a-fA-F].
Fields
source: FromHexErrorUnderlying hex decoding error.
KindMismatch
An ObjectHash of a different algorithm was supplied where expected was required.
Fields
UnknownKind
A tagged ID has a missing or unknown <kind>: prefix.
No HashKind can be attached because the tag is exactly what failed to
resolve; the accepted tag set and the lengths that were seen are carried
instead so the caller can still diagnose the input.
Fields
Accepted tags.
UnsupportedObjectType
object_type has no loose-object header (delta types) and therefore no canonical object ID.
Fields
object_type: ObjectTypeThe object type without a header.
Io
The underlying reader failed while reading a kind-sized ID.
Trait Implementations§
Source§impl Error for HashError
impl Error for HashError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Source§impl From<HashError> for GitError
impl From<HashError> for GitError
Source§fn from(err: HashError) -> Self
fn from(err: HashError) -> Self
Explicit-kind hash failures (length / hex / kind mismatch, unsupported
object type, short stream) surface as GitError::InvalidHashValue,
keeping the full diagnostic text of the crate::hash::HashError.
impl StructuralPartialEq for HashError
Auto Trait Implementations§
impl Freeze for HashError
impl RefUnwindSafe for HashError
impl Send for HashError
impl Sync for HashError
impl Unpin for HashError
impl UnsafeUnpin for HashError
impl UnwindSafe for HashError
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out indicating that a T is niched.