Lines Matching refs:Cow
20 use std::borrow::{Borrow, Cow};
41 type Item = (Cow<'a, str>, Cow<'a, str>);
62 fn decode(input: &[u8]) -> Cow<'_, str> { in decode()
65 Cow::Owned(vec) => Cow::Owned(vec), in decode()
66 Cow::Borrowed(_) => replaced, in decode()
71 fn replace_plus(input: &[u8]) -> Cow<'_, [u8]> { in replace_plus()
73 None => Cow::Borrowed(input), in replace_plus()
82 Cow::Owned(replaced) in replace_plus()
384 pub(crate) fn encode<'a>(encoding_override: EncodingOverride<'_>, input: &'a str) -> Cow<'a, [u8]> { in encode()
391 pub(crate) fn decode_utf8_lossy(input: Cow<'_, [u8]>) -> Cow<'_, str> { in decode_utf8_lossy()
394 Cow::Borrowed(bytes) => String::from_utf8_lossy(bytes), in decode_utf8_lossy()
395 Cow::Owned(bytes) => { in decode_utf8_lossy()
397 Cow::Borrowed(utf8) => { in decode_utf8_lossy()
412 Cow::Owned(unsafe { String::from_utf8_unchecked(bytes) }) in decode_utf8_lossy()
414 Cow::Owned(s) => Cow::Owned(s), in decode_utf8_lossy()
420 pub type EncodingOverride<'a> = Option<&'a dyn Fn(&str) -> Cow<'_, [u8]>>;