@@ -43,21 +43,6 @@ use crate::vec::Vec;
43
43
///
44
44
/// The `Debug` and `Display` implementations for `ByteString` are the same as those for `ByteStr`,
45
45
/// showing invalid UTF-8 as hex escapes or the Unicode replacement character, respectively.
46
- ///
47
- /// # Examples
48
- ///
49
- /// You can create a new `ByteString` from a `Vec<u8>` directly, or via a `From` impl from various
50
- /// string types:
51
- ///
52
- /// ```
53
- /// # #![feature(bstr)]
54
- /// # use std::bstr::ByteString;
55
- /// let s1 = ByteString(vec![b'H', b'e', b'l', b'l', b'o']);
56
- /// let s2 = ByteString::from("Hello");
57
- /// let s3 = ByteString::from(b"Hello");
58
- /// assert_eq!(s1, s2);
59
- /// assert_eq!(s2, s3);
60
- /// ```
61
46
#[ unstable( feature = "bstr" , issue = "134915" ) ]
62
47
#[ repr( transparent) ]
63
48
#[ derive( Clone ) ]
@@ -193,40 +178,42 @@ impl Default for ByteString {
193
178
}
194
179
}
195
180
196
- #[ cfg( not( test) ) ] // https://github.com/rust-lang/rust/issues/135100
197
- #[ unstable( feature = "bstr" , issue = "134915" ) ]
198
- impl < ' a , const N : usize > From < & ' a [ u8 ; N ] > for ByteString {
199
- #[ inline]
200
- fn from ( s : & ' a [ u8 ; N ] ) -> Self {
201
- ByteString ( s. as_slice ( ) . to_vec ( ) )
202
- }
203
- }
204
-
205
- #[ cfg( not( test) ) ] // https://github.com/rust-lang/rust/issues/135100
206
- #[ unstable( feature = "bstr" , issue = "134915" ) ]
207
- impl < const N : usize > From < [ u8 ; N ] > for ByteString {
208
- #[ inline]
209
- fn from ( s : [ u8 ; N ] ) -> Self {
210
- ByteString ( s. as_slice ( ) . to_vec ( ) )
211
- }
212
- }
213
-
214
- #[ cfg( not( test) ) ] // https://github.com/rust-lang/rust/issues/135100
215
- #[ unstable( feature = "bstr" , issue = "134915" ) ]
216
- impl < ' a > From < & ' a [ u8 ] > for ByteString {
217
- #[ inline]
218
- fn from ( s : & ' a [ u8 ] ) -> Self {
219
- ByteString ( s. to_vec ( ) )
220
- }
221
- }
222
-
223
- #[ unstable( feature = "bstr" , issue = "134915" ) ]
224
- impl From < Vec < u8 > > for ByteString {
225
- #[ inline]
226
- fn from ( s : Vec < u8 > ) -> Self {
227
- ByteString ( s)
228
- }
229
- }
181
+ // Omitted due to inference failures
182
+ //
183
+ // #[cfg(not(test))] // https://github.com/rust-lang/rust/issues/135100
184
+ // #[unstable(feature = "bstr", issue = "134915")]
185
+ // impl<'a, const N: usize> From<&'a [u8; N]> for ByteString {
186
+ // #[inline]
187
+ // fn from(s: &'a [u8; N]) -> Self {
188
+ // ByteString(s.as_slice().to_vec())
189
+ // }
190
+ // }
191
+ //
192
+ // #[cfg(not(test))] // https://github.com/rust-lang/rust/issues/135100
193
+ // #[unstable(feature = "bstr", issue = "134915")]
194
+ // impl<const N: usize> From<[u8; N]> for ByteString {
195
+ // #[inline]
196
+ // fn from(s: [u8; N]) -> Self {
197
+ // ByteString(s.as_slice().to_vec())
198
+ // }
199
+ // }
200
+ //
201
+ // #[cfg(not(test))] // https://github.com/rust-lang/rust/issues/135100
202
+ // #[unstable(feature = "bstr", issue = "134915")]
203
+ // impl<'a> From<&'a [u8]> for ByteString {
204
+ // #[inline]
205
+ // fn from(s: &'a [u8]) -> Self {
206
+ // ByteString(s.to_vec())
207
+ // }
208
+ // }
209
+ //
210
+ // #[unstable(feature = "bstr", issue = "134915")]
211
+ // impl From<Vec<u8>> for ByteString {
212
+ // #[inline]
213
+ // fn from(s: Vec<u8>) -> Self {
214
+ // ByteString(s)
215
+ // }
216
+ // }
230
217
231
218
#[ unstable( feature = "bstr" , issue = "134915" ) ]
232
219
impl From < ByteString > for Vec < u8 > {
@@ -236,22 +223,24 @@ impl From<ByteString> for Vec<u8> {
236
223
}
237
224
}
238
225
239
- #[ cfg( not( test) ) ] // https://github.com/rust-lang/rust/issues/135100
240
- #[ unstable( feature = "bstr" , issue = "134915" ) ]
241
- impl < ' a > From < & ' a str > for ByteString {
242
- #[ inline]
243
- fn from ( s : & ' a str ) -> Self {
244
- ByteString ( s. as_bytes ( ) . to_vec ( ) )
245
- }
246
- }
247
-
248
- #[ unstable( feature = "bstr" , issue = "134915" ) ]
249
- impl From < String > for ByteString {
250
- #[ inline]
251
- fn from ( s : String ) -> Self {
252
- ByteString ( s. into_bytes ( ) )
253
- }
254
- }
226
+ // Omitted due to inference failures
227
+ //
228
+ // #[cfg(not(test))] // https://github.com/rust-lang/rust/issues/135100
229
+ // #[unstable(feature = "bstr", issue = "134915")]
230
+ // impl<'a> From<&'a str> for ByteString {
231
+ // #[inline]
232
+ // fn from(s: &'a str) -> Self {
233
+ // ByteString(s.as_bytes().to_vec())
234
+ // }
235
+ // }
236
+ //
237
+ // #[unstable(feature = "bstr", issue = "134915")]
238
+ // impl From<String> for ByteString {
239
+ // #[inline]
240
+ // fn from(s: String) -> Self {
241
+ // ByteString(s.into_bytes())
242
+ // }
243
+ // }
255
244
256
245
#[ cfg( not( test) ) ] // https://github.com/rust-lang/rust/issues/135100
257
246
#[ unstable( feature = "bstr" , issue = "134915" ) ]
0 commit comments