rust: pin-init: change examples to the user-space version
authorBenno Lossin <benno.lossin@proton.me>
Sat, 8 Mar 2025 11:04:18 +0000 (11:04 +0000)
committerMiguel Ojeda <ojeda@kernel.org>
Sun, 16 Mar 2025 20:59:18 +0000 (21:59 +0100)
commit84837cf6fa541150a3012ea233225a7ecfa8771a
tree3b5f5d06d58b42cd86ad123937c1fbc59447ac60
parent4b11798e82d6f340c2afc94c57823b6fbc109fad
rust: pin-init: change examples to the user-space version

Replace the examples in the documentation by the ones from the
user-space version and introduce the standalone examples from the
user-space version such as the `CMutex<T>` type.

The `CMutex<T>` example from the pinned-init repository [1] is used in
several documentation examples in the user-space version instead of the
kernel `Mutex<T>` type (as it's not available). In order to split off
the pin-init crate, all examples need to be free of kernel-specific
types.

Link: https://github.com/rust-for-Linux/pinned-init
Signed-off-by: Benno Lossin <benno.lossin@proton.me>
Reviewed-by: Fiona Behrens <me@kloenk.dev>
Tested-by: Andreas Hindborg <a.hindborg@kernel.org>
Link: https://lore.kernel.org/r/20250308110339.2997091-6-benno.lossin@proton.me
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
rust/pin-init/examples/big_struct_in_place.rs [new file with mode: 0644]
rust/pin-init/examples/error.rs [new file with mode: 0644]
rust/pin-init/examples/linked_list.rs [new file with mode: 0644]
rust/pin-init/examples/mutex.rs [new file with mode: 0644]
rust/pin-init/examples/pthread_mutex.rs [new file with mode: 0644]
rust/pin-init/examples/static_init.rs [new file with mode: 0644]
rust/pin-init/src/lib.rs