Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ffc4a85

Browse files
committed
change!: From<&[u8]> is now From<&BStr>
This better represents the meaning of the input, and simplifies interactions with `git-config`.
1 parent 9b6a67b commit ffc4a85

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

git-url/src/lib.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use std::{
77
fmt::{self, Write},
88
};
99

10-
use bstr::ByteSlice;
10+
use bstr::{BStr, ByteSlice};
1111

1212
///
1313
pub mod parse;
@@ -101,18 +101,18 @@ impl Url {
101101
}
102102
}
103103

104-
impl TryFrom<&[u8]> for Url {
104+
impl TryFrom<&BStr> for Url {
105105
type Error = parse::Error;
106106

107-
fn try_from(value: &[u8]) -> Result<Self, Self::Error> {
107+
fn try_from(value: &BStr) -> Result<Self, Self::Error> {
108108
Self::from_bytes(value)
109109
}
110110
}
111111

112-
impl<'a> TryFrom<std::borrow::Cow<'a, [u8]>> for Url {
112+
impl<'a> TryFrom<std::borrow::Cow<'a, BStr>> for Url {
113113
type Error = parse::Error;
114114

115-
fn try_from(value: std::borrow::Cow<'a, [u8]>) -> Result<Self, Self::Error> {
115+
fn try_from(value: std::borrow::Cow<'a, BStr>) -> Result<Self, Self::Error> {
116116
Self::try_from(&*value)
117117
}
118118
}

0 commit comments

Comments
 (0)