Struct mod_mgmt::NamespaceDir

source ·
pub struct NamespaceDir(/* private fields */);
Expand description

A wrapper around a Directory reference that offers special convenience functions for getting and inserting crate object files into a directory.

Auto-derefs into a DirRef.

Implementations§

source§

impl NamespaceDir

source

pub fn new(dir: DirRef) -> NamespaceDir

Creates a new NamespaceDir that wraps the given DirRef.

source

pub fn get_file_starting_with(&self, prefix: &str) -> Option<FileRef>

Finds the single file in this directory whose name starts with the given prefix.

Return

If a single file matches, then that file is returned. Otherwise, if no files or multiple files match, then None is returned.

source

pub fn get_files_starting_with(&self, prefix: &str) -> Vec<FileRef>

Returns the list of files in this Directory whose name starts with the given prefix.

source

pub fn get_file_and_dir_names_starting_with(&self, prefix: &str) -> Vec<String>

Returns the list of file and directory names in this Directory whose name start with the given prefix.

source

pub fn get_crate_object_file( &self, crate_module_file_name: &str ) -> Option<FileRef>

Gets the given object file based on its crate name prefix.

Arguments
  • crate_object_file_name: the name of the object file to be returned, with or without a preceding CrateType prefix.
Examples
  • The name “k#keyboard-36be916209949cef.o” will look for and return the file “keyboard-36be916209949cef.o”.
  • The name “keyboard-36be916209949cef.o” will look for and return the file “keyboard-36be916209949cef.o”.
  • The name “a#ps.o” will look for and return the file “ps.o”.
source

pub fn write_crate_object_file( &self, crate_object_file_name: &str, content: &[u8] ) -> Result<FileRef, &'static str>

Insert the given crate object file based on its crate type prefix.

Arguments
  • crate_object_file_name: the name of the object file to be inserted, with a preceding CrateType prefix.
  • content: the bytes that will be written into the file.
Examples
  • The file “k#keyboard-36be916209949cef.o” will be written to “./keyboard-36be916209949cef.o”.
  • The file “a#ps.o” will be placed into “./ps.o”.

Trait Implementations§

source§

impl Clone for NamespaceDir

source§

fn clone(&self) -> NamespaceDir

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for NamespaceDir

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Deref for NamespaceDir

§

type Target = Arc<Mutex<dyn Directory + Send, Spin>, Global>

The resulting type after dereferencing.
source§

fn deref(&self) -> &DirRef

Dereferences the value.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.