@@ -541,9 +541,10 @@ impl StringView {
541
541
/// Basic usage:
542
542
///
543
543
/// ```
544
- /// use heapless::String;
544
+ /// use heapless::string::{ String, StringView} ;
545
545
///
546
546
/// let mut s: String<4> = String::try_from("ab")?;
547
+ /// let s: &mut StringView = &mut s;
547
548
/// assert!(s.as_str() == "ab");
548
549
///
549
550
/// let _s = s.as_str();
@@ -562,9 +563,10 @@ impl StringView {
562
563
/// Basic usage:
563
564
///
564
565
/// ```
565
- /// use heapless::String;
566
+ /// use heapless::string::{ String, StringView} ;
566
567
///
567
568
/// let mut s: String<4> = String::try_from("ab")?;
569
+ /// let s: &mut StringView = &mut s;
568
570
/// let s = s.as_mut_str();
569
571
/// s.make_ascii_uppercase();
570
572
/// # Ok::<(), ()>(())
@@ -588,12 +590,13 @@ impl StringView {
588
590
/// Basic usage:
589
591
///
590
592
/// ```
591
- /// use heapless::String;
593
+ /// use heapless::string::{ String,StringView} ;
592
594
///
593
595
/// let mut s: String<8> = String::try_from("hello")?;
596
+ /// let s: &mut StringView = &mut s;
594
597
///
595
598
/// unsafe {
596
- /// let vec = s.as_mut_vec ();
599
+ /// let vec = s.as_mut_vec_view ();
597
600
/// assert_eq!(&b"hello", &vec);
598
601
///
599
602
/// vec.reverse();
@@ -612,9 +615,10 @@ impl StringView {
612
615
/// Basic usage:
613
616
///
614
617
/// ```
615
- /// use heapless::String;
618
+ /// use heapless::string::{ String,StringView} ;
616
619
///
617
620
/// let mut s: String<8> = String::try_from("foo")?;
621
+ /// let s: &mut StringView = &mut s;
618
622
///
619
623
/// assert!(s.push_str("bar").is_ok());
620
624
///
@@ -636,9 +640,10 @@ impl StringView {
636
640
/// Basic usage:
637
641
///
638
642
/// ```
639
- /// use heapless::String;
643
+ /// use heapless::string::{ String,StringView} ;
640
644
///
641
- /// let mut s: String<4> = String::new();
645
+ /// let s: String<4> = String::new();
646
+ /// let s: &StringView = &s;
642
647
/// assert!(s.capacity() == 4);
643
648
/// ```
644
649
#[ inline]
@@ -653,9 +658,10 @@ impl StringView {
653
658
/// Basic usage:
654
659
///
655
660
/// ```
656
- /// use heapless::String;
661
+ /// use heapless::string::{ String,StringView} ;
657
662
///
658
663
/// let mut s: String<8> = String::try_from("abc")?;
664
+ /// let s: &mut StringView = &mut s;
659
665
///
660
666
/// s.push('1').unwrap();
661
667
/// s.push('2').unwrap();
@@ -694,9 +700,10 @@ impl StringView {
694
700
/// Basic usage:
695
701
///
696
702
/// ```
697
- /// use heapless::String;
703
+ /// use heapless::string::{ String,StringView} ;
698
704
///
699
705
/// let mut s: String<8> = String::try_from("hello")?;
706
+ /// let s: &mut StringView = &mut s;
700
707
///
701
708
/// s.truncate(2);
702
709
///
@@ -720,9 +727,10 @@ impl StringView {
720
727
/// Basic usage:
721
728
///
722
729
/// ```
723
- /// use heapless::String;
730
+ /// use heapless::string::{ String,StringView} ;
724
731
///
725
732
/// let mut s: String<8> = String::try_from("foo")?;
733
+ /// let s: &mut StringView = &mut s;
726
734
///
727
735
/// assert_eq!(s.pop(), Some('o'));
728
736
/// assert_eq!(s.pop(), Some('o'));
@@ -759,9 +767,10 @@ impl StringView {
759
767
/// Basic usage:
760
768
///
761
769
/// ```
762
- /// use heapless::String;
770
+ /// use heapless::string::{ String,StringView} ;
763
771
///
764
772
/// let mut s: String<8> = String::try_from("foo").unwrap();
773
+ /// let s: &mut StringView = &mut s;
765
774
///
766
775
/// assert_eq!(s.remove(0), 'f');
767
776
/// assert_eq!(s.remove(1), 'o');
@@ -794,9 +803,10 @@ impl StringView {
794
803
/// Basic usage:
795
804
///
796
805
/// ```
797
- /// use heapless::String;
806
+ /// use heapless::string::{ String, StringView} ;
798
807
///
799
808
/// let mut s: String<8> = String::try_from("foo")?;
809
+ /// let s: &mut StringView = &mut s;
800
810
///
801
811
/// s.clear();
802
812
///
0 commit comments