We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
str::Chars::as_str
1 parent feeca94 commit f98c55dCopy full SHA for f98c55d
src/libcore/str/mod.rs
@@ -459,6 +459,19 @@ impl<'a> Chars<'a> {
459
///
460
/// This has the same lifetime as the original slice, and so the
461
/// iterator can continue to be used while this exists.
462
+ ///
463
+ /// # Examples
464
465
+ /// ```
466
+ /// let mut chars = "abc".chars();
467
468
+ /// assert_eq!(chars.as_str(), "abc");
469
+ /// chars.next();
470
+ /// assert_eq!(chars.as_str(), "bc");
471
472
473
+ /// assert_eq!(chars.as_str(), "");
474
475
#[stable(feature = "iter_to_slice", since = "1.4.0")]
476
#[inline]
477
pub fn as_str(&self) -> &'a str {
0 commit comments