linux-stable/rust/kernel
Wedson Almeida Filho ef4dc4cc70 rust: error: Add from_result() helper
Add a helper function to easily return C result codes from a Rust function
that calls functions which return a Result<T>.

Lina: Imported from rust-for-linux/rust, originally developed by Wedson
as part of file_operations.rs. Added the allow() flags since there is no
user in the kernel crate yet and fixed a typo in a comment. Replaced the
macro with a function taking a closure, per discussion on the ML.

Co-developed-by: Fox Chen <foxhlchen@gmail.com>
Signed-off-by: Fox Chen <foxhlchen@gmail.com>
Co-developed-by: Miguel Ojeda <ojeda@kernel.org>
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
Signed-off-by: Wedson Almeida Filho <wedsonaf@gmail.com>
Reviewed-by: Martin Rodriguez Reboredo <yakoyoku@gmail.com>
Signed-off-by: Asahi Lina <lina@asahilina.net>
Link: https://lore.kernel.org/r/20230224-rust-error-v3-6-03779bddc02b@asahilina.net
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2023-04-12 18:41:04 +02:00
..
sync rust: sync: arc: Add UniqueArc<MaybeUninit<T>::assume_init() 2023-04-12 18:41:04 +02:00
allocator.rs
build_assert.rs rust: build_assert: add build_{error,assert}! macros 2022-12-04 01:59:16 +01:00
error.rs rust: error: Add from_result() helper 2023-04-12 18:41:04 +02:00
lib.rs rust: Enable the new_uninit feature for kernel and driver crates 2023-04-10 05:21:15 +02:00
prelude.rs rust: prelude: prevent doc inline of external imports 2023-01-16 23:49:46 +01:00
print.rs rust: print: avoid evaluating arguments in pr_* macros in unsafe blocks 2023-01-16 00:54:35 +01:00
static_assert.rs rust: static_assert: add static_assert! macro 2022-12-04 01:59:16 +01:00
std_vendor.rs rust: std_vendor: add dbg! macro based on std's one 2022-12-04 01:59:16 +01:00
str.rs rust: str: add fmt! macro 2022-12-04 01:59:16 +01:00
sync.rs rust: sync: introduce UniqueArc 2023-01-16 23:48:06 +01:00
types.rs rust: types: implement ForeignOwnable for the unit type 2023-02-01 13:24:36 +01:00