Re: [PATCH v8 2/7] rust: time: Introduce Delta type

From: Miguel Ojeda
Date: Wed Jan 22 2025 - 03:58:04 EST


On Wed, Jan 22, 2025 at 8:37 AM FUJITA Tomonori
<fujita.tomonori@xxxxxxxxx> wrote:
>
> Yes, please create such. I'll add more docs but I'm sure that there
> will be room for improvement.

Sounds good, will do!

> You want to add the above explanation to all the
> Delta::from_[millis|micro|secs], right?

Yeah, I meant to add the saturating note to each of them.

> Is there any existing source code I can refer to? I'm not sure
> how "module-level docs" should be written.

You can see e.g.

rust/kernel/block/mq.rs
rust/kernel/init.rs
rust/kernel/workqueue.rs

(grep `^//!` for others).

In general, you can use the module-level docs to talk about how things
relate between items of that module. For instance, when I saw in your
commit message this note:

Implement the subtraction operator for Instant:

Delta = Instant A - Instant B

I thought something like: "It would be nice to explain how `Delta` and
`Instant` fit together / how they are related / how all fits together
in the `time` module".

> I'll try to improve.

Thanks a lot! (really -- I personally appreciate good docs)

Cheers,
Miguel