pub struct Scope<T> { /* private fields */ }
Expand description
Handle to a DebugFS scope, which ensures that attached data
will outlive the DebugFS entry
without moving.
This is internally used to back File
, and used in the API to represent the attachment
of a directory lifetime to a data structure which may be jointly accessed by a number of
different files.
When dropped, a Scope
will remove all directories and files in the filesystem backed by the
attached data structure prior to releasing the attached data.
Implementations§
Source§impl<'a, T: 'a> Scope<T>
impl<'a, T: 'a> Scope<T>
Sourcepub fn dir<E: 'a, F>(
data: impl PinInit<T, E> + 'a,
name: &'a CStr,
init: F,
) -> impl PinInit<Self, E> + 'a
pub fn dir<E: 'a, F>( data: impl PinInit<T, E> + 'a, name: &'a CStr, init: F, ) -> impl PinInit<Self, E> + 'a
Creates a new scope, which is a directory at the root of the debugfs filesystem,
associated with some data T
.
The init
closure is called to populate the directory with files and subdirectories. These
files can reference the data stored in the scope.
The entire directory tree created within the scope will be removed when the returned
Scope
handle is dropped.
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for Scope<T>where
T: Freeze,
impl<T> !RefUnwindSafe for Scope<T>
impl<T> Send for Scope<T>where
T: Send,
impl<T> Sync for Scope<T>where
T: Sync,
impl<T> !UnwindSafe for Scope<T>
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