Add a `CommitObject::TryFrom<git2::Buf>` instance
Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
This commit is contained in:
parent
fece740fcb
commit
efdc8c52c7
|
|
@ -323,6 +323,14 @@ pub mod commit {
|
||||||
InvalidFormat,
|
InvalidFormat,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl TryFrom<git2::Buf> for CommitObject {
|
||||||
|
type Error = ParseError;
|
||||||
|
|
||||||
|
fn try_from(value: git2::Buf) -> Result<Self, Self::Error> {
|
||||||
|
value.as_str().ok_or(ParseError::InvalidFormat)?.parse()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl FromStr for CommitObject {
|
impl FromStr for CommitObject {
|
||||||
type Err = ParseError;
|
type Err = ParseError;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue