pub struct SysfsNode {
pub path: &'static str,
pub description: &'static str,
pub read_fn: Option<fn() -> String>,
pub write_fn: Option<fn(&str) -> KernelResult<()>>,
}Expand description
A virtual sysfs filesystem node.
Fields§
§path: &'static strFull path (e.g., “/sys/power/state”).
description: &'static strHuman-readable description.
read_fn: Option<fn() -> String>Read handler (None = write-only).
write_fn: Option<fn(&str) -> KernelResult<()>>Write handler (None = read-only).
Implementations§
Source§impl SysfsNode
impl SysfsNode
Sourcepub const fn read_only(
path: &'static str,
description: &'static str,
read_fn: fn() -> String,
) -> Self
pub const fn read_only( path: &'static str, description: &'static str, read_fn: fn() -> String, ) -> Self
Create a new read-only sysfs node.
Sourcepub const fn read_write(
path: &'static str,
description: &'static str,
read_fn: fn() -> String,
write_fn: fn(&str) -> KernelResult<()>,
) -> Self
pub const fn read_write( path: &'static str, description: &'static str, read_fn: fn() -> String, write_fn: fn(&str) -> KernelResult<()>, ) -> Self
Create a new read-write sysfs node.
Sourcepub fn is_writable(&self) -> bool
pub fn is_writable(&self) -> bool
Whether this node is writable.
Sourcepub fn is_readable(&self) -> bool
pub fn is_readable(&self) -> bool
Whether this node is readable.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SysfsNode
impl RefUnwindSafe for SysfsNode
impl Send for SysfsNode
impl Sync for SysfsNode
impl Unpin for SysfsNode
impl UnwindSafe for SysfsNode
Blanket Implementations§
§impl<T> Any for Twhere
T: 'static + ?Sized,
impl<T> Any for Twhere
T: 'static + ?Sized,
§impl<T> Borrow<T> for Twhere
T: ?Sized,
impl<T> Borrow<T> for Twhere
T: ?Sized,
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)