[PATCH v3 04/16] rust: str: make `RawFormatter::bytes_written` public.

Andreas Hindborg posted 16 patches 2 months, 3 weeks ago
There is a newer version of this series
[PATCH v3 04/16] rust: str: make `RawFormatter::bytes_written` public.
Posted by Andreas Hindborg 2 months, 3 weeks ago
rnull is going to make use of `kernel::str::RawFormatter::bytes_written`,
so make the visibility public.

Signed-off-by: Andreas Hindborg <a.hindborg@kernel.org>
---
 rust/kernel/str.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/rust/kernel/str.rs b/rust/kernel/str.rs
index 28a6179385fc..b1bc584803b0 100644
--- a/rust/kernel/str.rs
+++ b/rust/kernel/str.rs
@@ -761,7 +761,7 @@ pub(crate) fn pos(&self) -> *mut u8 {
     }
 
     /// Returns the number of bytes written to the formatter.
-    pub(crate) fn bytes_written(&self) -> usize {
+    pub fn bytes_written(&self) -> usize {
         self.pos - self.beg
     }
 }

-- 
2.47.2
Re: [PATCH v3 04/16] rust: str: make `RawFormatter::bytes_written` public.
Posted by Daniel Almeida 2 months ago

> On 11 Jul 2025, at 08:43, Andreas Hindborg <a.hindborg@kernel.org> wrote:
> 
> rnull is going to make use of `kernel::str::RawFormatter::bytes_written`,
> so make the visibility public.
> 
> Signed-off-by: Andreas Hindborg <a.hindborg@kernel.org>
> ---
> rust/kernel/str.rs | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/rust/kernel/str.rs b/rust/kernel/str.rs
> index 28a6179385fc..b1bc584803b0 100644
> --- a/rust/kernel/str.rs
> +++ b/rust/kernel/str.rs
> @@ -761,7 +761,7 @@ pub(crate) fn pos(&self) -> *mut u8 {
>     }
> 
>     /// Returns the number of bytes written to the formatter.
> -    pub(crate) fn bytes_written(&self) -> usize {
> +    pub fn bytes_written(&self) -> usize {
>         self.pos - self.beg
>     }
> }
> 
> -- 
> 2.47.2
> 
> 
> 

Reviewed-by: Daniel Almeida <daniel.almeida@collabora.com>
Re: [PATCH v3 04/16] rust: str: make `RawFormatter::bytes_written` public.
Posted by Alice Ryhl 2 months, 3 weeks ago
On Fri, Jul 11, 2025 at 01:43:05PM +0200, Andreas Hindborg wrote:
> rnull is going to make use of `kernel::str::RawFormatter::bytes_written`,
> so make the visibility public.
> 
> Signed-off-by: Andreas Hindborg <a.hindborg@kernel.org>

Making methods public can be part of making the type itself public. I
don't think a separate patch is needed.

Reviewed-by: Alice Ryhl <aliceryhl@google.com>
Re: [PATCH v3 04/16] rust: str: make `RawFormatter::bytes_written` public.
Posted by Andreas Hindborg 2 months ago
"Alice Ryhl" <aliceryhl@google.com> writes:

> On Fri, Jul 11, 2025 at 01:43:05PM +0200, Andreas Hindborg wrote:
>> rnull is going to make use of `kernel::str::RawFormatter::bytes_written`,
>> so make the visibility public.
>>
>> Signed-off-by: Andreas Hindborg <a.hindborg@kernel.org>
>
> Making methods public can be part of making the type itself public. I
> don't think a separate patch is needed.

I'll merge them.


Best regards,
Andreas Hindborg