summaryrefslogtreecommitdiff
path: root/samples/rust/rust_print.rs
AgeCommit message (Collapse)Author
2023-04-10samples: rust: print: Add sample code for Arc printingBoqun Feng
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>
2022-12-04rust: macros: take string literals in `module!`Gary Guo
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>
2022-12-01rust: samples: add `rust_print` exampleMiguel Ojeda
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>