Lines Matching defs:str
272 ($s:ident, $code:expr, $name:ident, $str:expr, $iters:expr) => {
275 let mut $s = $str;
1291 mod str;
2280 let v = v.iter().map(|s| &**s).collect::<Vec<&str>>();
2282 b.bytes = $len * mem::size_of::<&str>() as u64;
3496 use std::str::{from_utf8, from_utf8_unchecked};
3591 fn s(x: &str) -> String {
3610 let empty: &[&str] = &[];
3636 let empty: &[&str] = &[];
3649 let empty: &[&str] = &[];
3670 impl Borrow<str> for WeirdBorrow {
3671 fn borrow(&self) -> &str {
3828 let s: &str = &s;
3829 let expected: &str = &expected;
3842 let s: &mut str = &mut s;
3843 let expected: &mut str = &mut expected;
3895 // output str. This helps validate "critical points" where an input range
3914 let v: &str = &v;
3919 let v: &mut str = &mut v;
3928 let v: &str = &v;
3936 let v: &mut str = &mut v;
4134 const DATA: &str = "abcαβγ";
4198 const LOREM_PARAGRAPH: &str = "\
4237 let s: &mut str = &mut s;
4246 let s: &mut str = &mut s;
4777 let split: Vec<&str> = data.splitn(4, ' ').collect();
4780 let split: Vec<&str> = data.splitn(4, |c: char| c == ' ').collect();
4784 let split: Vec<&str> = data.splitn(4, 'ä').collect();
4787 let split: Vec<&str> = data.splitn(4, |c: char| c == 'ä').collect();
4795 let split: Vec<&str> = data.split('\n').collect();
4798 let split: Vec<&str> = data.split_terminator('\n').collect();
4806 let split: Vec<&str> = data.split_inclusive('\n').collect();
4811 let split: Vec<&str> = uppercase_separated
4825 let split: Vec<&str> = data.split_inclusive('\n').rev().collect();
4834 let split: Vec<&str> = uppercase_separated
4849 let split: Vec<&str> = data.rsplit(' ').collect();
4852 let split: Vec<&str> = data.rsplit("lämb").collect();
4855 let split: Vec<&str> = data.rsplit(|c: char| c == 'ä').collect();
4863 let split: Vec<&str> = data.rsplitn(2, ' ').collect();
4866 let split: Vec<&str> = data.rsplitn(2, "lämb").collect();
4869 let split: Vec<&str> = data.rsplitn(2, |c: char| c == 'ä').collect();
4900 let words: Vec<&str> = data.split_whitespace().collect();
4907 let lines: Vec<&str> = data.lines().collect();
4911 let lines: Vec<&str> = data.lines().collect();
4917 fn t(s: &str, sep: &str, u: &[&str]) {
4918 let v: Vec<&str> = s.split(sep).collect();
4941 fn t<S: Default + AsRef<str>>() {
4946 t::<&str>();
4948 t::<&mut str>();
4953 fn sum_len(v: &[&str]) -> usize {
4997 fn check_contains_all_substrings(s: &str) {
5033 let mut split: Vec<&str> = data.rsplitn(4, ' ').collect();
5037 let mut split: Vec<&str> = data.rsplitn(4, |c: char| c == ' ').collect();
5042 let mut split: Vec<&str> = data.rsplitn(4, 'ä').collect();
5046 let mut split: Vec<&str> = data.rsplitn(4, |c: char| c == 'ä').collect();
5055 let split: Vec<&str> = data.split(' ').collect();
5058 let mut rsplit: Vec<&str> = data.split(' ').rev().collect();
5062 let split: Vec<&str> = data.split(|c: char| c == ' ').collect();
5065 let mut rsplit: Vec<&str> = data.split(|c: char| c == ' ').rev().collect();
5070 let split: Vec<&str> = data.split('ä').collect();
5073 let mut rsplit: Vec<&str> = data.split('ä').rev().collect();
5077 let split: Vec<&str> = data.split(|c: char| c == 'ä').collect();
5080 let mut rsplit: Vec<&str> = data.split(|c: char| c == 'ä').rev().collect();
5089 let mut split: Vec<&str> = data.split('\n').rev().collect();
5093 let mut split: Vec<&str> = data.split_terminator('\n').rev().collect();
5189 // The only way to acquire a Box<str> in the first place is through a String, so just
5190 // test that we can round-trip between Box<str> and String.
5221 use std::str::pattern::SearchStep::{self, Done, Match, Reject};
5222 use std::str::pattern::{Pattern, ReverseSearcher, Searcher};
5228 use std::str::pattern::SearchStep::{Match, Reject};
5245 haystack: &'a str,
5423 with str::split, str::rsplit;
5430 with str::split_terminator, str::rsplit_terminator;
5437 with str::matches, str::rmatches;
5444 with str::match_indices, str::rmatch_indices;
5451 with str::splitn;
5458 with str::rsplitn;
5463 use std::str::pattern::Pattern;
5474 foo::<&str>("x");
5622 use std::str;
5631 impl<'a> IntoCow<'a, str> for String {
5632 fn into_cow(self) -> Cow<'a, str> {
5637 impl<'a> IntoCow<'a, str> for &'a str {
5638 fn into_cow(self) -> Cow<'a, str> {
5657 let s: &str = "abc";
5681 let ys: Cow<'_, str> = "hello".into_cow();
5685 let ys: Cow<'_, str> = "ศไทย中华Việt Nam".into_cow();
6040 assert!(std::str::from_utf8(s.as_bytes()).is_ok());
6229 assert_eq!(Ok(""), str::from_utf8(s.as_bytes()));
6252 assert_eq!(Ok(""), str::from_utf8(s.as_bytes()));
6497 test_from_cow!(string: &str);
6522 const COW: Cow<'_, str> = Cow::Borrowed("moo");
7647 fn drain<'new>(d: Drain<'static, &'static str>) -> Drain<'new, &'new str> {
7650 fn into_iter<'new>(i: IntoIter<&'static str>) -> IntoIter<&'new str> {
8884 mod str;
8912 // check that Cow<'a, str> implements addition
8919 let owned1: Cow<'_, str> = Cow::Owned(String::from("Hi, "));
8920 let owned2: Cow<'_, str> = Cow::Owned(String::from("Rustaceans!"));
8921 let owned_empty: Cow<'_, str> = Cow::Owned(String::new());
8948 let owned: Cow<'_, str> = Cow::Owned(String::from("Hi, "));
8949 let owned_empty: Cow<'_, str> = Cow::Owned(String::new());
8972 let mut owned1: Cow<'_, str> = Cow::Owned(String::from("Hi, "));
8973 let owned2: Cow<'_, str> = Cow::Owned(String::from("Rustaceans!"));
8974 let owned_empty: Cow<'_, str> = Cow::Owned(String::new());
9013 let mut owned: Cow<'_, str> = Cow::Owned(String::from("Hi, "));
9014 let owned_empty: Cow<'_, str> = Cow::Owned(String::new());
9044 let mut c1: Cow<'_, str> = Cow::Owned(String::with_capacity(25));
9047 let c2: Cow<'_, str> = Cow::Owned(s);
9050 let mut c3: Cow<'_, str> = Cow::Borrowed("bye");
12303 fn drain<'new>(d: Drain<'static, &'static str>) -> Drain<'new, &'new str> {
13206 let _ = w.write_str("str");
13209 t!(buf, "34helloline\nbar\n☃str");
13664 fn drain<'new>(d: Drain<'static, &'static str>) -> Drain<'new, &'new str> {
14972 //! *[See also the `str` primitive type](str).*
14974 //! The `&str` type is one of the two main string types, the other being `String`.
14979 //! A basic string declaration of `&str` type:
14991 //! let hello_world: &'static str = "Hello, world!";
15003 use core::str::pattern::{DoubleEndedSearcher, Pattern, ReverseSearcher, Searcher};
15013 pub use core::str::pattern;
15015 pub use core::str::EncodeUtf16;
15017 pub use core::str::SplitAsciiWhitespace;
15019 pub use core::str::SplitInclusive;
15021 pub use core::str::SplitWhitespace;
15023 pub use core::str::{from_utf8, from_utf8_mut, Bytes, CharIndices, Chars};
15025 pub use core::str::{from_utf8_unchecked, from_utf8_unchecked_mut, ParseBoolError};
15027 pub use core::str::{EscapeDebug, EscapeDefault, EscapeUnicode};
15029 pub use core::str::{FromStr, Utf8Error};
15032 pub use core::str::{Lines, LinesAny};
15034 pub use core::str::{MatchIndices, RMatchIndices};
15036 pub use core::str::{Matches, RMatches};
15038 pub use core::str::{RSplit, Split};
15040 pub use core::str::{RSplitN, SplitN};
15042 pub use core::str::{RSplitTerminator, SplitTerminator};
15044 /// Note: `str` in `Concat<str>` is not meaningful here.
15047 impl<S: Borrow<str>> Concat<str> for [S] {
15056 impl<S: Borrow<str>> Join<&str> for [S] {
15059 fn join(slice: &Self, sep: &str) -> String {
15105 // For this reason SliceConcat<T> is not specialized for T: Copy and SliceConcat<str> is the
15108 // the bounds for String-join are S: Borrow<str> and for Vec-join Borrow<[T]>
15109 // [T] and str both impl AsRef<[T]> for some T
15162 impl Borrow<str> for String {
15164 fn borrow(&self) -> &str {
15170 impl BorrowMut<str> for String {
15172 fn borrow_mut(&mut self) -> &mut str {
15178 impl ToOwned for str {
15195 impl str {
15196 /// Converts a `Box<str>` into a `Box<[u8]>` without copying or allocating.
15210 pub fn into_boxed_bytes(self: Box<str>) -> Box<[u8]> {
15240 pub fn replace<'a, P: Pattern<'a>>(&'a self, from: P, to: &str) -> String {
15278 pub fn replacen<'a, P: Pattern<'a>>(&'a self, pat: P, to: &str, count: usize) -> String {
15358 fn map_uppercase_sigma(from: &str, i: usize, to: &mut String) {
15429 /// Converts a [`Box<str>`] into a [`String`] without copying or allocating.
15443 pub fn into_string(self: Box<str>) -> String {
15492 /// [`make_ascii_uppercase`]: str::make_ascii_uppercase
15522 /// [`make_ascii_lowercase`]: str::make_ascii_lowercase
15543 /// let smile = unsafe { std::str::from_boxed_utf8_unchecked(smile_utf8) };
15549 pub unsafe fn from_boxed_utf8_unchecked(v: Box<[u8]>) -> Box<str> {
15550 unsafe { Box::from_raw(Box::into_raw(v) as *mut str) }
15677 let arc: Arc<str> = Arc::from("foo");
15717 let arc: Arc<str> = Arc::from("foo");
15718 let weak: Weak<str> = Arc::downgrade(&arc);
15972 let r: Arc<str> = Arc::from("foo");
16032 let r: Arc<str> = Arc::from(s);
16089 let r2str = r2.downcast::<&'static str>();
16224 use core::str::{lossy, pattern::Pattern};
16229 use crate::str::{self, from_boxed_utf8_unchecked, Chars, FromStr, Utf8Error};
16236 /// counterpart, the primitive [`str`].
16240 /// You can create a `String` from [a literal string][`str`] with [`String::from`]:
16249 /// append a [`&str`] with the [`push_str`] method:
16297 /// [`bytes`]: str::bytes
16298 /// [`chars`]: str::chars
16302 /// `String`s implement [`Deref`]`<Target=str>`, and so inherit all of [`str`]'s
16304 /// function which takes a [`&str`] by using an ampersand (`&`):
16307 /// fn takes_str(s: &str) { }
16314 /// This will create a [`&str`] from the `String` and pass it in. This
16316 /// [`&str`]s as arguments unless they need a `String` for some specific
16321 /// slice [`&'a str`][`&str`] implements the trait `TraitExample`, and the function
16329 /// impl<'a> TraitExample for &'a str {}
16343 /// `String` to a [`str`][`&str`], then referencing the [`str`][`&str`] back to
16344 /// [`&str`]. The second way is more idiomatic, however both work to do the
16384 /// [`as_ptr`]: str::as_ptr
16443 /// [`str`]: prim@str
16444 /// [`&str`]: prim@str
16464 /// The [`Utf8Error`] type provided by [`std::str`] represents an error that may
16465 /// occur when converting a slice of [`u8`]s to a [`&str`]. In this sense, it's
16469 /// [`Utf8Error`]: core::str::Utf8Error
16470 /// [`std::str`]: core::str
16471 /// [`&str`]: prim@str
16591 pub fn from_str(_: &str) -> String {
16611 /// If you need a [`&str`] instead of a `String`, consider
16612 /// [`str::from_utf8`].
16649 /// [`&str`]: prim@str
16654 match str::from_utf8(&vec) {
16679 /// This function returns a [`Cow<'a, str>`]. If our byte slice is invalid
16685 /// [`Cow<'a, str>`]: crate::borrow::Cow
16710 pub fn from_utf8_lossy(v: &[u8]) -> Cow<'_, str> {
16724 const REPLACEMENT: &str = "\u{FFFD}";
16779 /// Unlike [`from_utf8_lossy`] which returns a [`Cow<'a, str>`],
16784 /// [`Cow<'a, str>`]: crate::borrow::Cow
16955 pub fn as_str(&self) -> &str {
16975 pub fn as_mut_str(&mut self) -> &mut str {
16994 pub fn push_str(&mut self, string: &str) {
17129 /// fn process_data(data: &str) -> Result<String, TryReserveError> {
17167 /// fn process_data(data: &str) -> Result<String, TryReserveError> {
17401 use core::str::pattern::Searcher;
17573 pub fn insert_str(&mut self, idx: usize, string: &str) {
17783 pub fn replace_range<R>(&mut self, range: R, replace_with: &str)
17813 /// Converts this `String` into a [`Box`]`<`[`str`]`>`.
17817 /// [`str`]: prim@str
17830 pub fn into_boxed_str(self) -> Box<str> {
17881 /// The [`Utf8Error`] type provided by [`std::str`] represents an error that may
17882 /// occur when converting a slice of [`u8`]s to a [`&str`]. In this sense, it's
17886 /// [`std::str`]: core::str
17887 /// [`&str`]: prim@str
17952 impl<'a> FromIterator<&'a str> for String {
17953 fn from_iter<I: IntoIterator<Item = &'a str>>(iter: I) -> String {
17979 impl FromIterator<Box<str>> for String {
17980 fn from_iter<I: IntoIterator<Item = Box<str>>>(iter: I) -> String {
17988 impl<'a> FromIterator<Cow<'a, str>> for String {
17989 fn from_iter<I: IntoIterator<Item = Cow<'a, str>>>(iter: I) -> String {
18044 impl<'a> Extend<&'a str> for String {
18045 fn extend<I: IntoIterator<Item = &'a str>>(&mut self, iter: I) {
18050 fn extend_one(&mut self, s: &'a str) {
18056 impl Extend<Box<str>> for String {
18057 fn extend<I: IntoIterator<Item = Box<str>>>(&mut self, iter: I) {
18075 impl<'a> Extend<Cow<'a, str>> for String {
18076 fn extend<I: IntoIterator<Item = Cow<'a, str>>>(&mut self, iter: I) {
18081 fn extend_one(&mut self, s: Cow<'a, str>) {
18086 /// A convenience impl that delegates to the impl for `&str`.
18099 type Searcher = <&'b str as Pattern<'a>>::Searcher;
18101 fn into_searcher(self, haystack: &'a str) -> <&'b str as Pattern<'a>>::Searcher {
18106 fn is_contained_in(self, haystack: &'a str) -> bool {
18111 fn is_prefix_of(self, haystack: &'a str) -> bool {
18116 fn strip_prefix_of(self, haystack: &'a str) -> Option<&'a str> {
18121 fn is_suffix_of(self, haystack: &'a str) -> bool {
18126 fn strip_suffix_of(self, haystack: &'a str) -> Option<&'a str> {
18173 impl_eq! { String, str }
18174 impl_eq! { String, &'a str }
18175 impl_eq! { Cow<'a, str>, str }
18176 impl_eq! { Cow<'a, str>, &'b str }
18177 impl_eq! { Cow<'a, str>, String }
18242 /// Concatenating `&str` slices can be done by converting the first to a `String`:
18250 impl Add<&str> for String {
18254 fn add(mut self, other: &str) -> String {
18264 impl AddAssign<&str> for String {
18266 fn add_assign(&mut self, other: &str) {
18273 type Output = str;
18276 fn index(&self, index: ops::Range<usize>) -> &str {
18282 type Output = str;
18285 fn index(&self, index: ops::RangeTo<usize>) -> &str {
18291 type Output = str;
18294 fn index(&self, index: ops::RangeFrom<usize>) -> &str {
18300 type Output = str;
18303 fn index(&self, _index: ops::RangeFull) -> &str {
18304 unsafe { str::from_utf8_unchecked(&self.vec) }
18309 type Output = str;
18312 fn index(&self, index: ops::RangeInclusive<usize>) -> &str {
18318 type Output = str;
18321 fn index(&self, index: ops::RangeToInclusive<usize>) -> &str {
18329 fn index_mut(&mut self, index: ops::Range<usize>) -> &mut str {
18336 fn index_mut(&mut self, index: ops::RangeTo<usize>) -> &mut str {
18343 fn index_mut(&mut self, index: ops::RangeFrom<usize>) -> &mut str {
18350 fn index_mut(&mut self, _index: ops::RangeFull) -> &mut str {
18351 unsafe { str::from_utf8_unchecked_mut(&mut *self.vec) }
18357 fn index_mut(&mut self, index: ops::RangeInclusive<usize>) -> &mut str {
18364 fn index_mut(&mut self, index: ops::RangeToInclusive<usize>) -> &mut str {
18371 type Target = str;
18374 fn deref(&self) -> &str {
18375 unsafe { str::from_utf8_unchecked(&self.vec) }
18382 fn deref_mut(&mut self) -> &mut str {
18383 unsafe { str::from_utf8_unchecked_mut(&mut *self.vec) }
18399 fn from_str(s: &str) -> Result<String, Self::Err> {
18463 impl ToString for str {
18471 impl ToString for Cow<'_, str> {
18487 impl AsRef<str> for String {
18489 fn as_ref(&self) -> &str {
18495 impl AsMut<str> for String {
18497 fn as_mut(&mut self) -> &mut str {
18511 impl From<&str> for String {
18513 fn from(s: &str) -> String {
18519 impl From<&mut str> for String {
18520 /// Converts a `&mut str` into a `String`.
18524 fn from(s: &mut str) -> String {
18540 impl From<Box<str>> for String {
18541 /// Converts the given boxed `str` slice to a `String`.
18542 /// It is notable that the `str` slice is owned.
18550 /// let s2: Box<str> = s1.into_boxed_str();
18555 fn from(s: Box<str>) -> String {
18561 impl From<String> for Box<str> {
18562 /// Converts the given `String` to a boxed `str` slice that is owned.
18570 /// let s2: Box<str> = Box::from(s1);
18575 fn from(s: String) -> Box<str> {
18581 impl<'a> From<Cow<'a, str>> for String {
18582 fn from(s: Cow<'a, str>) -> String {
18588 impl<'a> From<&'a str> for Cow<'a, str> {
18600 fn from(s: &'a str) -> Cow<'a, str> {
18606 impl<'a> From<String> for Cow<'a, str> {
18617 /// assert_eq!(Cow::from(s), Cow::<'static, str>::Owned(s2));
18620 fn from(s: String) -> Cow<'a, str> {
18626 impl<'a> From<&'a String> for Cow<'a, str> {
18639 fn from(s: &'a String) -> Cow<'a, str> {
18645 impl<'a> FromIterator<char> for Cow<'a, str> {
18646 fn from_iter<I: IntoIterator<Item = char>>(it: I) -> Cow<'a, str> {
18652 impl<'a, 'b> FromIterator<&'b str> for Cow<'a, str> {
18653 fn from_iter<I: IntoIterator<Item = &'b str>>(it: I) -> Cow<'a, str> {
18659 impl<'a> FromIterator<String> for Cow<'a, str> {
18660 fn from_iter<I: IntoIterator<Item = String>>(it: I) -> Cow<'a, str> {
18689 fn write_str(&mut self, s: &str) -> fmt::Result {
18759 pub fn as_str(&self) -> &str {
18766 // impl<'a> AsRef<str> for Drain<'a> {
18767 // fn as_ref(&self) -> &str {
18863 /// let s: &str = "a";
19037 /// let bull: Cow<'_, str> = Cow::Owned("...moo?".to_string());
19057 /// let cow: Cow<'_, str> = Cow::Owned("moo".to_string());
19083 /// Cow::Owned(String::from("FOO")) as Cow<str>
19127 /// let cow: Cow<str> = Cow::Owned(String::from(s));
19248 impl<'a> Add<&'a str> for Cow<'a, str> {
19249 type Output = Cow<'a, str>;
19252 fn add(mut self, rhs: &'a str) -> Self::Output {
19259 impl<'a> Add<Cow<'a, str>> for Cow<'a, str> {
19260 type Output = Cow<'a, str>;
19263 fn add(mut self, rhs: Cow<'a, str>) -> Self::Output {
19270 impl<'a> AddAssign<&'a str> for Cow<'a, str> {
19271 fn add_assign(&mut self, rhs: &'a str) {
19286 impl<'a> AddAssign<Cow<'a, str>> for Cow<'a, str> {
19287 fn add_assign(&mut self, rhs: Cow<'a, str>) {
19481 pub mod str;
21234 impl From<&str> for Rc<str> {
21241 /// let shared: Rc<str> = Rc::from("statue");
21245 fn from(v: &str) -> Rc<str> {
21247 unsafe { Rc::from_raw(Rc::into_raw(rc) as *const str) }
21252 impl From<String> for Rc<str> {
21260 /// let shared: Rc<str> = Rc::from(original);
21264 fn from(v: String) -> Rc<str> {
21984 //! let str_slice: &[&str] = &["one", "two", "three"];
25575 impl From<&str> for Arc<str> {
25576 /// Allocate a reference-counted `str` and copy `v` into it.
25582 /// let shared: Arc<str> = Arc::from("eggplant");
25586 fn from(v: &str) -> Arc<str> {
25588 unsafe { Arc::from_raw(Arc::into_raw(arc) as *const str) }
25593 impl From<String> for Arc<str> {
25594 /// Allocate a reference-counted `str` and copy `v` into it.
25601 /// let shared: Arc<str> = Arc::from(unique);
25605 fn from(v: String) -> Arc<str> {
25618 /// let unique: Box<str> = Box::from("eggplant");
25619 /// let shared: Arc<str> = Arc::from(unique);
25810 //! `printf`/`fprintf` functions or Python's `str.format` function.
26559 let rc: Rc<str> = Rc::from("foo");
26599 let arc: Rc<str> = Rc::from("foo");
26600 let weak: Weak<str> = Rc::downgrade(&arc);
26746 let r: Rc<str> = Rc::from("foo");
26806 let r: Rc<str> = Rc::from(s);
26863 let r2str = r2.downcast::<&'static str>();
28717 fn a<'a>(x: LinkedList<&'static str>) -> LinkedList<&'a str> {
28720 fn b<'i, 'a>(x: Iter<'i, &'static str>) -> Iter<'i, &'a str> {
28723 fn c<'a>(x: IntoIter<&'static str>) -> IntoIter<&'a str> {
29868 /// // would be `BTreeMap<&str, &str>` in this example).
29913 /// // would be `BTreeMap<&str, u8>` in this example).
30864 /// let mut map: BTreeMap<&str, i32> = ["Alice", "Bob", "Carol", "Cheryl"]
30898 /// let mut count: BTreeMap<&str, usize> = BTreeMap::new();
31067 /// let values: Vec<&str> = a.into_values().collect();
31929 /// let values: Vec<&str> = a.values().cloned().collect();
32205 /// // would be `BTreeSet<&str>` in this example).
34764 struct Foo(&'static str, i32);
34810 fn set<'new>(v: BTreeSet<&'static str>) -> BTreeSet<&'new str> {
34813 fn iter<'a, 'new>(v: Iter<'a, &'static str>) -> Iter<'a, &'new str> {
34816 fn into_iter<'new>(v: IntoIter<&'static str>) -> IntoIter<&'new str> {
34819 fn range<'a, 'new>(v: Range<'a, &'static str>) -> Range<'a, &'new str> {
35163 /// let mut map: BTreeMap<&str, usize> = BTreeMap::new();
35184 /// let mut map: BTreeMap<&str, String> = BTreeMap::new();
35211 /// let mut map: BTreeMap<&str, usize> = BTreeMap::new();
35236 /// let mut map: BTreeMap<&str, usize> = BTreeMap::new();
35255 /// let mut map: BTreeMap<&str, usize> = BTreeMap::new();
35292 /// let mut map: BTreeMap<&str, Option<usize>> = BTreeMap::new();
35314 /// let mut map: BTreeMap<&str, usize> = BTreeMap::new();
35330 /// let mut map: BTreeMap<&str, usize> = BTreeMap::new();
35350 /// let mut map: BTreeMap<&str, u32> = BTreeMap::new();
35390 /// let mut map: BTreeMap<&str, usize> = BTreeMap::new();
35407 /// let mut map: BTreeMap<&str, usize> = BTreeMap::new();
35431 /// let mut map: BTreeMap<&str, usize> = BTreeMap::new();
35456 /// let mut map: BTreeMap<&str, usize> = BTreeMap::new();
35486 /// let mut map: BTreeMap<&str, usize> = BTreeMap::new();
35509 /// let mut map: BTreeMap<&str, usize> = BTreeMap::new();
35530 /// let mut map: BTreeMap<&str, usize> = BTreeMap::new();
36419 let mut iter = map.range::<str, _>((Included("b"), Excluded("d")));
37110 fn map_key<'new>(v: BTreeMap<&'static str, ()>) -> BTreeMap<&'new str, ()> {
37113 fn map_val<'new>(v: BTreeMap<(), &'static str>) -> BTreeMap<(), &'new str> {
37117 fn iter_key<'a, 'new>(v: Iter<'a, &'static str, ()>) -> Iter<'a, &'new str, ()> {
37120 fn iter_val<'a, 'new>(v: Iter<'a, (), &'static str>) -> Iter<'a, (), &'new str> {
37124 fn into_iter_key<'new>(v: IntoIter<&'static str, ()>) -> IntoIter<&'new str, ()> {
37127 fn into_iter_val<'new>(v: IntoIter<(), &'static str>) -> IntoIter<(), &'new str> {
37131 fn into_keys_key<'new>(v: IntoKeys<&'static str, ()>) -> IntoKeys<&'new str, ()> {
37134 fn into_keys_val<'new>(v: IntoKeys<(), &'static str>) -> IntoKeys<(), &'new str> {
37138 fn into_values_key<'new>(v: IntoValues<&'static str, ()>) -> IntoValues<&'new str, ()> {
37141 fn into_values_val<'new>(v: IntoValues<(), &'static str>) -> IntoValues<(), &'new str> {
37145 fn range_key<'a, 'new>(v: Range<'a, &'static str, ()>) -> Range<'a, &'new str, ()> {
37148 fn range_val<'a, 'new>(v: Range<'a, (), &'static str>) -> Range<'a, (), &'new str> {
37152 fn keys_key<'a, 'new>(v: Keys<'a, &'static str, ()>) -> Keys<'a, &'new str, ()> {
37155 fn keys_val<'a, 'new>(v: Keys<'a, (), &'static str>) -> Keys<'a, (), &'new str> {
37159 fn values_key<'a, 'new>(v: Values<'a, &'static str, ()>) -> Values<'a, &'new str, ()> {
37162 fn values_val<'a, 'new>(v: Values<'a, (), &'static str>) -> Values<'a, (), &'new str> {
47046 /// [`&str`].
47169 /// [`&str`]: type@str
49643 impl From<&str> for Vec<u8> {
49651 fn from(s: &str) -> Vec<u8> {
50326 use crate::str::from_boxed_utf8_unchecked;
51194 impl Default for Box<str> {
51250 impl Clone for Box<str> {
51424 impl From<&str> for Box<str> {
51425 /// Converts a `&str` into a `Box<str>`
51432 /// let boxed: Box<str> = Box::from("hello");
51436 fn from(s: &str) -> Box<str> {
51442 impl From<Cow<'_, str>> for Box<str> {
51444 fn from(cow: Cow<'_, str>) -> Box<str> {
51453 impl<A: Allocator> From<Box<str, A>> for Box<[u8], A> {
51454 /// Converts a `Box<str>` into a `Box<[u8]>`
51460 /// // create a Box<str> which will be used to create a Box<[u8]>
51461 /// let boxed: Box<str> = Box::from("hello");
51471 fn from(s: Box<str, A>) -> Self {
52073 let boxed: Box<str> = Box::from(s);