str.rs (fe33c0fbed75dd464747c0faaedf94c7d8eb4101) str.rs (b6cda913bba42e1fdad82df41d906ff603319743)
1// SPDX-License-Identifier: GPL-2.0
2
3//! String representations.
4
5use alloc::alloc::AllocError;
6use alloc::vec::Vec;
7use core::fmt::{self, Write};
8use core::ops::{self, Deref, Index};

--- 435 unchanged lines hidden (view full) ---

444
445 /// Returns the current insert position.
446 ///
447 /// N.B. It may point to invalid memory.
448 pub(crate) fn pos(&self) -> *mut u8 {
449 self.pos as _
450 }
451
1// SPDX-License-Identifier: GPL-2.0
2
3//! String representations.
4
5use alloc::alloc::AllocError;
6use alloc::vec::Vec;
7use core::fmt::{self, Write};
8use core::ops::{self, Deref, Index};

--- 435 unchanged lines hidden (view full) ---

444
445 /// Returns the current insert position.
446 ///
447 /// N.B. It may point to invalid memory.
448 pub(crate) fn pos(&self) -> *mut u8 {
449 self.pos as _
450 }
451
452 /// Return the number of bytes written to the formatter.
452 /// Returns the number of bytes written to the formatter.
453 pub(crate) fn bytes_written(&self) -> usize {
454 self.pos - self.beg
455 }
456}
457
458impl fmt::Write for RawFormatter {
459 fn write_str(&mut self, s: &str) -> fmt::Result {
460 // `pos` value after writing `len` bytes. This does not have to be bounded by `end`, but we

--- 161 unchanged lines hidden ---
453 pub(crate) fn bytes_written(&self) -> usize {
454 self.pos - self.beg
455 }
456}
457
458impl fmt::Write for RawFormatter {
459 fn write_str(&mut self, s: &str) -> fmt::Result {
460 // `pos` value after writing `len` bytes. This does not have to be bounded by `end`, but we

--- 161 unchanged lines hidden ---