[05/13] rust: str: use `NUL` instead of 0 in doc comments

Message ID 20240116220537.168057-1-kernel@valentinobst.de
State New
Headers
Series rust: kernel: documentation improvements |

Commit Message

Valentin Obst Jan. 16, 2024, 10:05 p.m. UTC
  Throughout the module, bytes with the value zero are referred to as
`NUL` bytes. Adapt the only two outliers.

Signed-off-by: Valentin Obst <kernel@valentinobst.de>
---
 rust/kernel/str.rs | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
  

Comments

Trevor Gross Jan. 18, 2024, 12:39 a.m. UTC | #1
On Tue, Jan 16, 2024 at 5:36 PM Valentin Obst <kernel@valentinobst.de> wrote:
>
> Throughout the module, bytes with the value zero are referred to as
> `NUL` bytes. Adapt the only two outliers.
>
> Signed-off-by: Valentin Obst <kernel@valentinobst.de>
> ---
>  rust/kernel/str.rs | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/rust/kernel/str.rs b/rust/kernel/str.rs
> index 0a8569594fc3..843ffeec9b3e 100644
> --- a/rust/kernel/str.rs
> +++ b/rust/kernel/str.rs
> @@ -149,13 +149,13 @@ pub const fn as_char_ptr(&self) -> *const core::ffi::c_char {
>          self.0.as_ptr() as _
>      }
>
> -    /// Convert the string to a byte slice without the trailing 0 byte.
> +    /// Convert the string to a byte slice without the trailing `NUL` byte.
>      #[inline]
>      pub fn as_bytes(&self) -> &[u8] {
>          &self.0[..self.len()]
>      }
>
> -    /// Convert the string to a byte slice containing the trailing 0 byte.
> +    /// Convert the string to a byte slice containing the trailing `NUL` byte.
>      #[inline]
>      pub const fn as_bytes_with_nul(&self) -> &[u8] {
>          &self.0
> --
> 2.43.0
>
>

Reviewed-by: Trevor Gross <tmgross@umich.edu>
  

Patch

diff --git a/rust/kernel/str.rs b/rust/kernel/str.rs
index 0a8569594fc3..843ffeec9b3e 100644
--- a/rust/kernel/str.rs
+++ b/rust/kernel/str.rs
@@ -149,13 +149,13 @@  pub const fn as_char_ptr(&self) -> *const core::ffi::c_char {
         self.0.as_ptr() as _
     }
 
-    /// Convert the string to a byte slice without the trailing 0 byte.
+    /// Convert the string to a byte slice without the trailing `NUL` byte.
     #[inline]
     pub fn as_bytes(&self) -> &[u8] {
         &self.0[..self.len()]
     }
 
-    /// Convert the string to a byte slice containing the trailing 0 byte.
+    /// Convert the string to a byte slice containing the trailing `NUL` byte.
     #[inline]
     pub const fn as_bytes_with_nul(&self) -> &[u8] {
         &self.0