pub struct LooseObject {
pub object_type: LooseObjectType,
pub size: usize,
pub content: Vec<u8>,
pub object_id: String,
pub parsed_content: Option<ParsedContent>,
}
Fields§
§object_type: LooseObjectType
§size: usize
§content: Vec<u8>
§object_id: String
§parsed_content: Option<ParsedContent>
Implementations§
Source§impl LooseObject
impl LooseObject
Sourcepub fn read_from_path(path: &Path) -> Result<Self, LooseObjectError>
pub fn read_from_path(path: &Path) -> Result<Self, LooseObjectError>
Read and parse a loose object from the given path
§Errors
This function will return an error if:
- The file path cannot be read
- The object ID cannot be extracted from the path
- The file cannot be decompressed
- The object format is invalid
- The object type is unknown
Sourcepub fn content_as_string(&self) -> String
pub fn content_as_string(&self) -> String
Get the content as a UTF-8 string (for text objects like commits)
Sourcepub const fn get_parsed_content(&self) -> Option<&ParsedContent>
pub const fn get_parsed_content(&self) -> Option<&ParsedContent>
Get parsed content if available
Trait Implementations§
Source§impl Clone for LooseObject
impl Clone for LooseObject
Source§fn clone(&self) -> LooseObject
fn clone(&self) -> LooseObject
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl Freeze for LooseObject
impl RefUnwindSafe for LooseObject
impl Send for LooseObject
impl Sync for LooseObject
impl Unpin for LooseObject
impl UnwindSafe for LooseObject
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
Converts
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>
Converts
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 more