pub struct ModInfoBuilder<const N: usize> { /* private fields */ }
Expand description
Builder for firmware module info.
ModInfoBuilder
is a helper component to flexibly compose firmware paths strings for the
.modinfo section in const context.
Therefore the ModInfoBuilder
provides the methods ModInfoBuilder::new_entry
and
ModInfoBuilder::push
, where the latter is used to push path components and the former to
mark the beginning of a new path string.
ModInfoBuilder
is meant to be used in combination with kernel::module_firmware!
.
The const generic N
as well as the module_name
parameter of ModInfoBuilder::new
is an
internal implementation detail and supplied through the above macro.
Implementations§
Source§impl<const N: usize> ModInfoBuilder<N>
impl<const N: usize> ModInfoBuilder<N>
Sourcepub const fn push(self, s: &str) -> Self
pub const fn push(self, s: &str) -> Self
Push an additional path component.
Append path components to the ModInfoBuilder
instance. Paths need to be separated
with ModInfoBuilder::new_entry
.
§Example
use kernel::firmware::ModInfoBuilder;
let builder = builder.new_entry()
.push(DIR)
.push("foo.bin")
.new_entry()
.push(DIR)
.push("bar.bin");
Sourcepub const fn new_entry(self) -> Self
pub const fn new_entry(self) -> Self
Prepare the ModInfoBuilder
for the next entry.
This method acts as a separator between module firmware path entries.
Must be called before constructing a new entry with subsequent calls to
ModInfoBuilder::push
.
See ModInfoBuilder::push
for an example.
Source§impl ModInfoBuilder<0>
impl ModInfoBuilder<0>
Sourcepub const fn build_length(self) -> usize
pub const fn build_length(self) -> usize
Return the length of the byte array to build.
Auto Trait Implementations§
impl<const N: usize> Freeze for ModInfoBuilder<N>
impl<const N: usize> RefUnwindSafe for ModInfoBuilder<N>
impl<const N: usize> Send for ModInfoBuilder<N>
impl<const N: usize> Sync for ModInfoBuilder<N>
impl<const N: usize> Unpin for ModInfoBuilder<N>
impl<const N: usize> UnwindSafe for ModInfoBuilder<N>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> PinInit<T> for T
impl<T> PinInit<T> for T
Source§unsafe fn __pinned_init(self, slot: *mut T) -> Result<(), Infallible>
unsafe fn __pinned_init(self, slot: *mut T) -> Result<(), Infallible>
slot
. Read more