Re: [PATCH v5 2/4] rust: debugfs: Bind file creation for long-lived Display

From: Alice Ryhl
Date: Fri May 09 2025 - 08:59:48 EST


On Tue, May 6, 2025 at 1:51 AM Matthew Maurer <mmaurer@xxxxxxxxxx> wrote:
>
> Allows creation of files for references that live forever and lack
> metadata through the `Display` implementation.
>
> The reference must live forever because we do not have a maximum
> lifetime for the file we are creating.
>
> The `Display` implementation is used because `seq_printf` needs to route
> through `%pA`, which in turn routes through Arguments. A more generic
> API is provided later in the series, implemented in terms of this one.
>
> Signed-off-by: Matthew Maurer <mmaurer@xxxxxxxxxx>

I believe it should be possible to bind owned data to a `File` using a
signature like this:

fn create_file<T>(&self, name: &CStr, data: impl PinInit<T>) -> impl
PinInit<FileWithData<T>>