Re: [PATCH v2] rust: time: implement `Display` for `Delta`
From: Andreas Hindborg
Date: Tue Nov 10 2026 - 03:15:47 EST
FUJITA Tomonori <tomo@xxxxxxxxxxxx> writes:
> On Wed, 04 Nov 2026 11:07:42 +0100
> Andreas Hindborg <a.hindborg@xxxxxxxxxx> wrote:
>
>> We can also change it to be a `Debug` implementation. I was not aware
>> about the stability requirement. But I guess that is mostly a user space
>> thing? In the kernel we can change stuff as we see fit, as long as we do
>> not interfere with the uapi.
>
> Right, in the kernel we can change the format as needed.
>
> Still, I think it is easier for users if the kernel crate follows some
> rule about when to implement Display and when to implement Debug.
>
> As Miguel's suggestions in v1 show (12_345ns, 12.345ms, 12.3ms), Delta
> does not have a single obvious format. In the kernel crate, other
> types with a unit, Hertz, MicroVolt and MicroWatt, implement only
> Debug, not Display. Display for Delta would be the first exception.
>
> So I would prefer Debug.
Ok, I can respin it as Debug.
>
> Maybe we should also write such a rule down in
> Documentation/rust/coding-guidelines.rst.
Good idea, I suggest you submit a patch, then general discussion can
happen in that thread.
Best regards,
Andreas Hindborg