Skip to content

Commit 4ba8f0e

Browse files
Update documentation of StringView functions to document StringView
1 parent fb72dca commit 4ba8f0e

File tree

1 file changed

+22
-12
lines changed

1 file changed

+22
-12
lines changed

src/string.rs

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -541,9 +541,10 @@ impl StringView {
541541
/// Basic usage:
542542
///
543543
/// ```
544-
/// use heapless::String;
544+
/// use heapless::string::{String, StringView};
545545
///
546546
/// let mut s: String<4> = String::try_from("ab")?;
547+
/// let s: &mut StringView = &mut s;
547548
/// assert!(s.as_str() == "ab");
548549
///
549550
/// let _s = s.as_str();
@@ -562,9 +563,10 @@ impl StringView {
562563
/// Basic usage:
563564
///
564565
/// ```
565-
/// use heapless::String;
566+
/// use heapless::string::{String, StringView};
566567
///
567568
/// let mut s: String<4> = String::try_from("ab")?;
569+
/// let s: &mut StringView = &mut s;
568570
/// let s = s.as_mut_str();
569571
/// s.make_ascii_uppercase();
570572
/// # Ok::<(), ()>(())
@@ -588,12 +590,13 @@ impl StringView {
588590
/// Basic usage:
589591
///
590592
/// ```
591-
/// use heapless::String;
593+
/// use heapless::string::{String,StringView};
592594
///
593595
/// let mut s: String<8> = String::try_from("hello")?;
596+
/// let s: &mut StringView = &mut s;
594597
///
595598
/// unsafe {
596-
/// let vec = s.as_mut_vec();
599+
/// let vec = s.as_mut_vec_view();
597600
/// assert_eq!(&b"hello", &vec);
598601
///
599602
/// vec.reverse();
@@ -612,9 +615,10 @@ impl StringView {
612615
/// Basic usage:
613616
///
614617
/// ```
615-
/// use heapless::String;
618+
/// use heapless::string::{String,StringView};
616619
///
617620
/// let mut s: String<8> = String::try_from("foo")?;
621+
/// let s: &mut StringView = &mut s;
618622
///
619623
/// assert!(s.push_str("bar").is_ok());
620624
///
@@ -636,9 +640,10 @@ impl StringView {
636640
/// Basic usage:
637641
///
638642
/// ```
639-
/// use heapless::String;
643+
/// use heapless::string::{String,StringView};
640644
///
641-
/// let mut s: String<4> = String::new();
645+
/// let s: String<4> = String::new();
646+
/// let s: &StringView = &s;
642647
/// assert!(s.capacity() == 4);
643648
/// ```
644649
#[inline]
@@ -653,9 +658,10 @@ impl StringView {
653658
/// Basic usage:
654659
///
655660
/// ```
656-
/// use heapless::String;
661+
/// use heapless::string::{String,StringView};
657662
///
658663
/// let mut s: String<8> = String::try_from("abc")?;
664+
/// let s: &mut StringView = &mut s;
659665
///
660666
/// s.push('1').unwrap();
661667
/// s.push('2').unwrap();
@@ -694,9 +700,10 @@ impl StringView {
694700
/// Basic usage:
695701
///
696702
/// ```
697-
/// use heapless::String;
703+
/// use heapless::string::{String,StringView};
698704
///
699705
/// let mut s: String<8> = String::try_from("hello")?;
706+
/// let s: &mut StringView = &mut s;
700707
///
701708
/// s.truncate(2);
702709
///
@@ -720,9 +727,10 @@ impl StringView {
720727
/// Basic usage:
721728
///
722729
/// ```
723-
/// use heapless::String;
730+
/// use heapless::string::{String,StringView};
724731
///
725732
/// let mut s: String<8> = String::try_from("foo")?;
733+
/// let s: &mut StringView = &mut s;
726734
///
727735
/// assert_eq!(s.pop(), Some('o'));
728736
/// assert_eq!(s.pop(), Some('o'));
@@ -759,9 +767,10 @@ impl StringView {
759767
/// Basic usage:
760768
///
761769
/// ```
762-
/// use heapless::String;
770+
/// use heapless::string::{String,StringView};
763771
///
764772
/// let mut s: String<8> = String::try_from("foo").unwrap();
773+
/// let s: &mut StringView = &mut s;
765774
///
766775
/// assert_eq!(s.remove(0), 'f');
767776
/// assert_eq!(s.remove(1), 'o');
@@ -794,9 +803,10 @@ impl StringView {
794803
/// Basic usage:
795804
///
796805
/// ```
797-
/// use heapless::String;
806+
/// use heapless::string::{String, StringView};
798807
///
799808
/// let mut s: String<8> = String::try_from("foo")?;
809+
/// let s: &mut StringView = &mut s;
800810
///
801811
/// s.clear();
802812
///

0 commit comments

Comments
 (0)