Re: [PATCH v2] rust: time: implement `Display` for `Delta`

From: FUJITA Tomonori

Date: Mon Nov 09 2026 - 17:58:24 EST


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.

Maybe we should also write such a rule down in
Documentation/rust/coding-guidelines.rst.