All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alice Ryhl <aliceryhl@google.com>
To: Danilo Krummrich <dakr@kernel.org>
Cc: lorenzo.stoakes@oracle.com, vbabka@suse.cz,
	Liam.Howlett@oracle.com,  urezki@gmail.com, ojeda@kernel.org,
	alex.gaynor@gmail.com,  boqun.feng@gmail.com, gary@garyguo.net,
	bjorn3_gh@protonmail.com,  lossin@kernel.org,
	a.hindborg@kernel.org, tmgross@umich.edu,
	 abdiel.janulgue@gmail.com, acourbot@nvidia.com,
	 rust-for-linux@vger.kernel.org
Subject: Re: [PATCH v3 4/7] rust: page: define trait IntoPageIter
Date: Mon, 11 Aug 2025 09:16:59 +0000	[thread overview]
Message-ID: <aJm1C7Pehrh8FIFa@google.com> (raw)
In-Reply-To: <20250808181155.223504-5-dakr@kernel.org>

On Fri, Aug 08, 2025 at 08:10:18PM +0200, Danilo Krummrich wrote:
> The IntoPageIter trait provides a common interface for types that
> provide a page iterator, such as VmallocPageIter.
> 
> Subsequent patches will leverage this to let VBox and VVec provide a
> VmallocPageIter though this trait.
> 
> Signed-off-by: Danilo Krummrich <dakr@kernel.org>
> ---
>  rust/kernel/page.rs | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/rust/kernel/page.rs b/rust/kernel/page.rs
> index 631718a6ad7d..bfb5898ab4b5 100644
> --- a/rust/kernel/page.rs
> +++ b/rust/kernel/page.rs
> @@ -103,6 +103,16 @@ fn deref(&self) -> &Self::Target {
>      }
>  }
>  
> +/// Trait to be implemented by types, which provide an [`Iterator`] implementation of
> +/// [`BorrowedPage`] items, such as [`VmallocPageIter`](kernel::alloc::allocator::VmallocPageIter).
> +pub trait IntoPageIter<'a> {
> +    /// The [`Iterator`] type, e.g. [`VmallocPageIter`](kernel::alloc::allocator::VmallocPageIter).
> +    type Iter: Iterator<Item = BorrowedPage<'a>>;

Oh, also, I would put the lifetime on Iter.

trait AsPageIter {
    type Iter<'a>: Iterator<Item = BorrowedPage<'a>>;
    fn page_iter(&mut self) -> Self::Iter<'_>;
}

Alice

  parent reply	other threads:[~2025-08-11  9:17 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-08 18:10 [PATCH v3 0/7] BorrowedPage, IntoPageIter and VmallocPageIter Danilo Krummrich
2025-08-08 18:10 ` [PATCH v3 1/7] rust: page: implement BorrowedPage Danilo Krummrich
2025-08-08 18:10 ` [PATCH v3 2/7] rust: alloc: vmalloc: implement Vmalloc::to_page() Danilo Krummrich
2025-08-11  9:11   ` Alice Ryhl
2025-08-08 18:10 ` [PATCH v3 3/7] rust: alloc: implement VmallocPageIter Danilo Krummrich
2025-08-11  9:14   ` Alice Ryhl
2025-08-11  9:30     ` Danilo Krummrich
2025-08-08 18:10 ` [PATCH v3 4/7] rust: page: define trait IntoPageIter Danilo Krummrich
2025-08-11  8:57   ` Alice Ryhl
2025-08-11  9:01     ` Danilo Krummrich
2025-08-11  9:16   ` Alice Ryhl [this message]
2025-08-11 10:38     ` Danilo Krummrich
2025-08-11 10:41       ` Alice Ryhl
2025-08-08 18:10 ` [PATCH v3 5/7] rust: alloc: kbox: implement IntoPageIter for VBox Danilo Krummrich
2025-08-08 18:10 ` [PATCH v3 6/7] rust: alloc: layout: implement ArrayLayout::size() Danilo Krummrich
2025-08-19 13:09   ` Daniel Almeida
2025-08-08 18:10 ` [PATCH v3 7/7] rust: alloc: kvec: implement IntoPageIter for VVec Danilo Krummrich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aJm1C7Pehrh8FIFa@google.com \
    --to=aliceryhl@google.com \
    --cc=Liam.Howlett@oracle.com \
    --cc=a.hindborg@kernel.org \
    --cc=abdiel.janulgue@gmail.com \
    --cc=acourbot@nvidia.com \
    --cc=alex.gaynor@gmail.com \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun.feng@gmail.com \
    --cc=dakr@kernel.org \
    --cc=gary@garyguo.net \
    --cc=lorenzo.stoakes@oracle.com \
    --cc=lossin@kernel.org \
    --cc=ojeda@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=tmgross@umich.edu \
    --cc=urezki@gmail.com \
    --cc=vbabka@suse.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.