]> git.ipfire.org Git - thirdparty/linux.git/commit
rust: alloc: kvec: add doc example for as_slice method
authorHui Zhu <zhuhui@kylinos.cn>
Thu, 31 Jul 2025 02:50:06 +0000 (10:50 +0800)
committerDanilo Krummrich <dakr@kernel.org>
Wed, 13 Aug 2025 16:52:31 +0000 (18:52 +0200)
commit7cedf7345cce7a12c28cce8df0bdc8a62d4ca438
treeeb1ca7dc8d9ae6364e458684562437e097469bd7
parent8f5ae30d69d7543eee0d70083daf4de8fe15d585
rust: alloc: kvec: add doc example for as_slice method

Add a practical usage example to the documentation of KVec::as_slice()
showing how to:
Create a new KVec.
Push elements into it.
Convert to a slice via as_slice().

Co-developed-by: Geliang Tang <geliang@kernel.org>
Signed-off-by: Geliang Tang <geliang@kernel.org>
Signed-off-by: Hui Zhu <zhuhui@kylinos.cn>
Reviewed-by: Alice Ryhl <aliceryhl@google.com>
Reviewed-by: Kunwu Chan <chentao@kylinos.cn>
Reviewed-by: David Gow <davidgow@google.com>
Link: https://lore.kernel.org/r/4e7f396f38ed8a780f863384bfc3d7de135ef3ea.1753929369.git.zhuhui@kylinos.cn
Signed-off-by: Danilo Krummrich <dakr@kernel.org>
rust/kernel/alloc/kvec.rs