|
40 | 40 | #![no_std] |
41 | 41 | extern crate alloc; |
42 | 42 |
|
43 | | -use alloc::{borrow::{Cow, ToOwned}, vec::Vec, string::String}; |
| 43 | +use alloc::{ |
| 44 | + borrow::{Cow, ToOwned}, |
| 45 | + string::String, |
| 46 | + vec::Vec, |
| 47 | +}; |
44 | 48 | use core::{fmt, mem, slice, str}; |
45 | 49 |
|
46 | 50 | /// Represents a set of characters or bytes in the ASCII range. |
@@ -307,42 +311,6 @@ impl<'a> From<PercentEncode<'a>> for Cow<'a, str> { |
307 | 311 | } |
308 | 312 | } |
309 | 313 |
|
310 | | -#[cfg(feature = "beef")] |
311 | | -impl<'a> From<PercentEncode<'a>> for beef::Cow<'a, str> { |
312 | | - fn from(mut iter: PercentEncode<'a>) -> Self { |
313 | | - match iter.next() { |
314 | | - None => "".into(), |
315 | | - Some(first) => match iter.next() { |
316 | | - None => first.into(), |
317 | | - Some(second) => { |
318 | | - let mut string = first.to_owned(); |
319 | | - string.push_str(second); |
320 | | - string.extend(iter); |
321 | | - string.into() |
322 | | - } |
323 | | - }, |
324 | | - } |
325 | | - } |
326 | | -} |
327 | | - |
328 | | -#[cfg(all(feature = "beef", target_pointer_width = "64"))] |
329 | | -impl<'a> From<PercentEncode<'a>> for beef::lean::Cow<'a, str> { |
330 | | - fn from(mut iter: PercentEncode<'a>) -> Self { |
331 | | - match iter.next() { |
332 | | - None => "".into(), |
333 | | - Some(first) => match iter.next() { |
334 | | - None => first.into(), |
335 | | - Some(second) => { |
336 | | - let mut string = first.to_owned(); |
337 | | - string.push_str(second); |
338 | | - string.extend(iter); |
339 | | - string.into() |
340 | | - } |
341 | | - }, |
342 | | - } |
343 | | - } |
344 | | -} |
345 | | - |
346 | 314 | /// Percent-decode the given string. |
347 | 315 | /// |
348 | 316 | /// <https://url.spec.whatwg.org/#string-percent-decode> |
@@ -420,26 +388,6 @@ impl<'a> From<PercentDecode<'a>> for Cow<'a, [u8]> { |
420 | 388 | } |
421 | 389 | } |
422 | 390 |
|
423 | | -#[cfg(feature = "beef")] |
424 | | -impl<'a> From<PercentDecode<'a>> for beef::Cow<'a, [u8]> { |
425 | | - fn from(iter: PercentDecode<'a>) -> Self { |
426 | | - match iter.if_any() { |
427 | | - Some(vec) => beef::Cow::owned(vec), |
428 | | - None => beef::Cow::borrowed(iter.bytes.as_slice()), |
429 | | - } |
430 | | - } |
431 | | -} |
432 | | - |
433 | | -#[cfg(all(feature = "beef", target_pointer_width = "64"))] |
434 | | -impl<'a> From<PercentDecode<'a>> for beef::lean::Cow<'a, [u8]> { |
435 | | - fn from(iter: PercentDecode<'a>) -> Self { |
436 | | - match iter.if_any() { |
437 | | - Some(vec) => beef::lean::Cow::owned(vec), |
438 | | - None => beef::lean::Cow::borrowed(iter.bytes.as_slice()), |
439 | | - } |
440 | | - } |
441 | | -} |
442 | | - |
443 | 391 | impl<'a> PercentDecode<'a> { |
444 | 392 | /// If the percent-decoding is different from the input, return it as a new bytes vector. |
445 | 393 | fn if_any(&self) -> Option<Vec<u8>> { |
|
0 commit comments