Message ID | 20250211-module-params-v3-v6-3-24b297ddc43d@kernel.org (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | rust: extend `module!` macro with integer parameter support | expand |
Context | Check | Description |
---|---|---|
mcgrof/vmtest-modules-next-PR | fail | PR summary |
mcgrof/vmtest-modules-next-VM_Test-2 | fail | Logs for cleanup / Archive results and cleanup |
mcgrof/vmtest-modules-next-VM_Test-4 | fail | Logs for setup / Setup kdevops environment |
mcgrof/vmtest-modules-next-VM_Test-5 | fail | Logs for setup / Setup kdevops environment |
mcgrof/vmtest-modules-next-VM_Test-1 | success | Logs for Run CI tests |
mcgrof/vmtest-modules-next-VM_Test-3 | fail | Logs for cleanup / Archive results and cleanup |
mcgrof/vmtest-modules-next-VM_Test-0 | success | Logs for Run CI tests |
diff --git a/rust/kernel/str.rs b/rust/kernel/str.rs index 1eb945bed77d6..389341455b962 100644 --- a/rust/kernel/str.rs +++ b/rust/kernel/str.rs @@ -125,6 +125,18 @@ fn index(&self, index: Idx) -> &Self::Output { } } +impl AsRef<BStr> for [u8] { + fn as_ref(&self) -> &BStr { + BStr::from_bytes(self) + } +} + +impl AsRef<BStr> for BStr { + fn as_ref(&self) -> &BStr { + self + } +} + /// Creates a new [`BStr`] from a string literal. /// /// `b_str!` converts the supplied string literal to byte string, so non-ASCII
Implement `AsRef<BStr>` for `[u8]` and `BStr` so these can be used interchangeably for operations on `BStr`. Signed-off-by: Andreas Hindborg <a.hindborg@kernel.org> --- rust/kernel/str.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+)