History log of /linux-master/samples/rust/rust_print.rs
Revision Date Author Comments
# f431c5c5 07-Feb-2023 Boqun Feng <boqun.feng@gmail.com>

samples: rust: print: Add sample code for Arc printing

This both demonstrates the usage of different print format in Rust and
serves as a selftest for the `Display` and `Debug` implementation of
`Arc` and its friends.

Signed-off-by: Boqun Feng <boqun.feng@gmail.com>
Reviewed-by: Björn Roy Baron <bjorn3_gh@protonmail.com>
Reviewed-by: Finn Behrens <fin@nyantec.com>
Reviewed-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
Reviewed-by: Gary Guo <gary@garyguo.net>
Reviewed-by: Andreas Hindborg <a.hindborg@samsung.com>
Link: https://lore.kernel.org/r/20230207185216.1314638-3-boqun.feng@gmail.com
[ Applied suggestions and reworded for fixing title typos. ]
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>


# b13c9880 10-Nov-2022 Gary Guo <gary@garyguo.net>

rust: macros: take string literals in `module!`

Instead of taking binary string literals, take string ones instead,
making it easier for users to define a module, i.e. instead of
calling `module!` like:

module! {
...
name: b"rust_minimal",
...
}

now it is called as:

module! {
...
name: "rust_minimal",
...
}

Module names, aliases and license strings are restricted to
ASCII only. However, the author and the description allows UTF-8.

For simplicity (avoid parsing), escape sequences and raw string
literals are not yet handled.

Link: https://github.com/Rust-for-Linux/linux/issues/252
Link: https://lore.kernel.org/lkml/YukvvPOOu8uZl7+n@yadro.com/
Signed-off-by: Gary Guo <gary@garyguo.net>
[Reworded, adapted for upstream and applied latest changes]
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>


# c3630df6 10-Nov-2022 Miguel Ojeda <ojeda@kernel.org>

rust: samples: add `rust_print` example

Add example to exercise the printing macros (`pr_*!`) introduced
in the previous patches.

Reviewed-by: Finn Behrens <me@kloenk.dev>
Reviewed-by: Wei Liu <wei.liu@kernel.org>
Tested-by: Sergio González Collado <sergio.collado@gmail.com>
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>