Home
last modified time | relevance | path

Searched refs:Cow (Results 1 – 25 of 56) sorted by relevance

123

/third_party/rust/crates/rustix/src/path/
Darg.rs13 use alloc::borrow::Cow;
74 fn to_string_lossy(&self) -> Cow<'_, str>; in to_string_lossy()
77 fn as_cow_c_str(&self) -> io::Result<Cow<'_, CStr>>; in as_cow_c_str()
81 fn into_c_str<'b>(self) -> io::Result<Cow<'b, CStr>> in into_c_str()
99 fn to_string_lossy(&self) -> Cow<'_, str> { in to_string_lossy()
100 Cow::Borrowed(self) in to_string_lossy()
104 fn as_cow_c_str(&self) -> io::Result<Cow<'_, CStr>> { in as_cow_c_str()
105 Ok(Cow::Owned( in as_cow_c_str()
111 fn into_c_str<'b>(self) -> io::Result<Cow<'b, CStr>> in into_c_str()
115 Ok(Cow::Owned( in into_c_str()
[all …]
/third_party/rust/crates/os_str_bytes/src/
Dlib.rs183 use std::borrow::Cow;
313 ) -> result::Result<Cow<'a, OsStr>, imp::EncodingError> in from_raw_bytes()
315 S: Into<Cow<'a, [u8]>>, in from_raw_bytes()
318 Cow::Borrowed(string) => imp::os_str_from_bytes(string), in from_raw_bytes()
319 Cow::Owned(string) => imp::os_string_from_vec(string).map(Cow::Owned), in from_raw_bytes()
323 fn cow_os_str_into_path(string: Cow<'_, OsStr>) -> Cow<'_, Path> { in cow_os_str_into_path()
325 Cow::Borrowed(string) => Cow::Borrowed(Path::new(string)), in cow_os_str_into_path()
326 Cow::Owned(string) => Cow::Owned(string.into()), in cow_os_str_into_path()
363 fn assert_from_raw_bytes<'a, S>(string: S) -> Cow<'a, Self> in assert_from_raw_bytes()
365 S: Into<Cow<'a, [u8]>>; in assert_from_raw_bytes()
[all …]
Draw_str.rs2 use std::borrow::Cow;
137 pub fn new(string: &OsStr) -> Cow<'_, Self> { in new()
139 Cow::Borrowed(string) => Cow::Borrowed(Self::from_inner(string)), in new()
140 Cow::Owned(string) => Cow::Owned(RawOsString(string)), in new()
720 pub fn to_os_str(&self) -> Cow<'_, OsStr> { in to_os_str()
766 pub fn to_str_lossy(&self) -> Cow<'_, str> { in to_str_lossy()
891 impl<'a> From<&'a RawOsStr> for Cow<'a, RawOsStr> { implementation
894 Cow::Borrowed(value) in from()
937 fn into_os_str(self) -> Cow<'a, OsStr>; in into_os_str()
958 fn into_raw_bytes(self) -> Cow<'a, [u8]>; in into_raw_bytes()
[all …]
/third_party/rust/crates/os_str_bytes/src/windows/
Dmod.rs5 use std::borrow::Cow;
36 fn position(&self) -> Cow<'_, str> { in position()
38 Self::Byte(byte) => Cow::Owned(format!("byte b'\\x{:02X}'", byte)), in position()
40 Cow::Owned(format!("code point U+{:04X}", code_point)) in position()
42 Self::End() => Cow::Borrowed("end of string"), in position()
87 pub(super) fn os_str_from_bytes(string: &[u8]) -> Result<Cow<'_, OsStr>> { in os_str_from_bytes()
89 os_string.map(Cow::Owned).unwrap_or_else(|| { in os_str_from_bytes()
91 Cow::Borrowed(OsStr::new(unsafe { in os_str_from_bytes()
98 pub(super) fn os_str_to_bytes(os_string: &OsStr) -> Cow<'_, [u8]> { in os_str_to_bytes()
99 Cow::Owned(to_bytes(os_string)) in os_str_to_bytes()
/third_party/rust/crates/regex/tests/
Dreplace.rs155 t!(std::borrow::Cow::<'_, str>::Borrowed("Z")),
163 t!(&std::borrow::Cow::<'_, str>::Borrowed("Z")),
171 t!(std::borrow::Cow::<'_, str>::Owned("Z".to_string())),
179 t!(&std::borrow::Cow::<'_, str>::Owned("Z".to_string())),
204 bytes!(std::borrow::Cow::<'_, [u8]>::Borrowed(&[b'Z'])),
212 bytes!(&std::borrow::Cow::<'_, [u8]>::Borrowed(&[b'Z'])),
220 bytes!(std::borrow::Cow::<'_, [u8]>::Owned(vec![b'Z'])),
228 bytes!(&std::borrow::Cow::<'_, [u8]>::Owned(vec![b'Z'])),
/third_party/rust/crates/rustix/tests/path/
Darg.rs6 use std::borrow::Cow;
84 let t: Cow<'_, str> = Cow::Borrowed("hello"); in test_arg()
90 let t: Cow<'_, str> = Cow::Owned("hello".to_owned()); in test_arg()
96 let t: Cow<'_, OsStr> = Cow::Borrowed(OsStr::new("hello")); in test_arg()
102 let t: Cow<'_, OsStr> = Cow::Owned(OsString::from("hello".to_owned())); in test_arg()
108 let t: Cow<'_, CStr> = Cow::Borrowed(cstr!("hello")); in test_arg()
114 let t: Cow<'_, CStr> = Cow::Owned(cstr!("hello").to_owned()); in test_arg()
/third_party/rust/crates/regex/src/
Dre_unicode.rs1 use std::borrow::Cow;
510 ) -> Cow<'t, str> { in replace()
524 ) -> Cow<'t, str> { in replace_all()
539 ) -> Cow<'t, str> { in replacen()
552 return Cow::Borrowed(text); in replacen()
565 return Cow::Owned(new); in replacen()
572 return Cow::Borrowed(text); in replacen()
587 Cow::Owned(new) in replacen()
1179 fn no_expansion<'r>(&'r mut self) -> Option<Cow<'r, str>> { in no_expansion()
1219 fn no_expansion(&mut self) -> Option<Cow<'_, str>> { in no_expansion()
[all …]
Dre_bytes.rs1 use std::borrow::Cow;
461 ) -> Cow<'t, [u8]> { in replace()
475 ) -> Cow<'t, [u8]> { in replace_all()
490 ) -> Cow<'t, [u8]> { in replacen()
494 return Cow::Borrowed(text); in replacen()
507 return Cow::Owned(new); in replacen()
514 return Cow::Borrowed(text); in replacen()
529 Cow::Owned(new) in replacen()
1128 fn no_expansion<'r>(&'r mut self) -> Option<Cow<'r, [u8]>> { in no_expansion()
1168 fn no_expansion<'r>(&'r mut self) -> Option<Cow<'r, [u8]>> { in no_expansion()
[all …]
/third_party/rust/crates/env_logger/src/
Dlib.rs287 use std::{borrow::Cow, cell::RefCell, env, io};
324 name: Cow<'a, str>,
325 default: Option<Cow<'a, str>>,
982 E: Into<Cow<'a, str>>, in filter()
994 E: Into<Cow<'a, str>>, in filter_or()
995 V: Into<Cow<'a, str>>, in filter_or()
1007 V: Into<Cow<'a, str>>, in default_filter_or()
1021 E: Into<Cow<'a, str>>, in write_style()
1033 E: Into<Cow<'a, str>>, in write_style_or()
1034 V: Into<Cow<'a, str>>, in write_style_or()
[all …]
/third_party/rust/crates/libloading/src/
Dutil.rs1 use std::borrow::Cow;
10 pub(crate) fn cstr_cow_from_bytes(slice: &[u8]) -> Result<Cow<'_, CStr>, Error> { in cstr_cow_from_bytes()
14 None => unsafe { Cow::Borrowed(CStr::from_ptr(&ZERO)) }, in cstr_cow_from_bytes()
16 Some(&0) => Cow::Borrowed( in cstr_cow_from_bytes()
22 Cow::Owned(CString::new(slice).map_err(|source| Error::CreateCString { source })?) in cstr_cow_from_bytes()
/third_party/rust/crates/serde/test_suite/tests/
Dtest_borrow.rs6 use std::borrow::Cow;
123 copied: Cow<'a, str>, in test_cow()
126 borrowed: Cow<'b, str>, in test_cow()
145 Cow::Owned(ref s) if s == "copied" => {} in test_cow()
150 Cow::Borrowed("borrowed") => {} in test_cow()
159 _copied: Cow<'a, str>, in test_lifetimes()
162 _borrowed: Cow<'b, str>, in test_lifetimes()
/third_party/rust/crates/os_str_bytes/src/common/
Dmod.rs1 use std::borrow::Cow;
29 pub(super) fn os_str_from_bytes(string: &[u8]) -> Result<Cow<'_, OsStr>> { in os_str_from_bytes()
30 Ok(Cow::Borrowed(OsStrExt::from_bytes(string))) in os_str_from_bytes()
33 pub(super) fn os_str_to_bytes(os_string: &OsStr) -> Cow<'_, [u8]> { in os_str_to_bytes()
34 Cow::Borrowed(OsStrExt::as_bytes(os_string)) in os_str_to_bytes()
/third_party/rust/crates/os_str_bytes/src/wasm/
Dmod.rs1 use std::borrow::Cow;
42 pub(super) fn os_str_from_bytes(string: &[u8]) -> Result<Cow<'_, OsStr>> { in os_str_from_bytes()
43 from_bytes(string).map(|x| Cow::Borrowed(OsStr::new(x))) in os_str_from_bytes()
46 pub(super) fn os_str_to_bytes(os_string: &OsStr) -> Cow<'_, [u8]> { in os_str_to_bytes()
47 Cow::Borrowed(expect_utf8!(os_string.to_str()).as_bytes()) in os_str_to_bytes()
/third_party/rust/crates/rust-openssl/openssl-errors/src/
Dlib.rs52 use std::borrow::Cow;
62 pub use std::borrow::Cow;
139 message: Option<Cow<'static, str>>, in __put_error()
152 message: Option<Cow<'static, str>>, in put_error_inner()
175 Some(Cow::Borrowed(s)) => Some((s.as_ptr() as *const c_char as *mut c_char, 0)), in put_error_inner()
176 Some(Cow::Owned(s)) => { in put_error_inner()
221 $crate::export::Option::Some($crate::export::Cow::Borrowed(
234 $crate::export::Option::Some($crate::export::Cow::Owned(
/third_party/rust/crates/codespan/codespan-reporting/tests/snapshots/
Dterm__unicode_spans__rich_no_color.snap15 │ -- Cow range does not start at boundary.
21 │ -- Cow range does not end at boundary.
27 │ ------ Cow does not start or end at boundary.
/third_party/rust/crates/os_str_bytes/tests/
Dcommon.rs13 use std::borrow::Cow;
35 S: Into<Cow<'a, [u8]>>,
45 pub(crate) fn from_bytes(string: &[u8]) -> Result<Cow<'_, OsStr>> {
81 assert_eq!(Ok(Cow::Borrowed(os_string)), from_bytes(string));
Drandom.rs3 use std::borrow::Cow;
24 assert_eq!(Ok(Cow::Borrowed(&*os_string)), common::from_bytes(&string)); in test_bytes()
/third_party/rust/crates/rust-openssl/openssl/src/
Derror.rs20 use std::borrow::Cow;
105 data: Option<Cow<'static, str>>,
132 Cow::Owned(data.to_string()) in get()
134 Cow::Borrowed(data) in get()
137 let data = Cow::Borrowed(data); in get()
169 Some(Cow::Borrowed(data)) => Some((data.as_ptr() as *mut c_char, 0)), in put()
170 Some(Cow::Owned(ref data)) => { in put()
/third_party/rust/crates/quote/tests/
Dtest.rs8 use std::borrow::Cow;
115 let item_ty = quote!(Cow<'a, str>); in test_advanced()
388 let owned: Cow<Ident> = Cow::Owned(Ident::new("owned", Span::call_site())); in test_cow()
391 let borrowed = Cow::Borrowed(&ident); in test_cow()
426 let id5 = format_ident!("Hello{}", Cow::Borrowed("World")); in test_format_ident()
/third_party/rust/crates/env_logger/src/fmt/writer/termcolor/
Dextern_impl.rs1 use std::borrow::Cow;
253 style: Cow<'a, Style>,
415 style: Cow::Borrowed(self), in value()
423 style: Cow::Owned(self), in into_value()
/third_party/rust/crates/quote/src/
Dident_fragment.rs3 use std::borrow::Cow;
58 impl<T> IdentFragment for Cow<'_, T> implementation
Dto_tokens.rs4 use std::borrow::Cow;
89 impl<'a, T: ?Sized + ToOwned + ToTokens> ToTokens for Cow<'a, T> { implementation
/third_party/rust/crates/proc-macro-error/src/
Ddiagnostic.rs216 use std::borrow::Cow; in to_tokens()
238 Cow::Borrowed(msg) in to_tokens()
252 Cow::Owned(message) in to_tokens()
/third_party/rust/crates/syn/examples/dump-syntax/src/
Dmain.rs21 use std::borrow::Cow;
119 .unwrap_or(Cow::Borrowed("main.rs")); in render_location()
/third_party/rust/crates/log/src/kv/
Dkey.rs116 use std::borrow::Cow;
124 impl<'a> ToKey for Cow<'a, str> { implementation

123