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
impl NamespaceDir
sourcepub fn new(dir: DirRef) -> NamespaceDir
pub fn new(dir: DirRef) -> NamespaceDir
Creates a new NamespaceDir
that wraps the given DirRef
.
sourcepub fn get_file_starting_with(&self, prefix: &str) -> Option<FileRef>
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.
sourcepub fn get_files_starting_with(&self, prefix: &str) -> Vec<FileRef>
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
.
sourcepub fn get_file_and_dir_names_starting_with(&self, prefix: &str) -> Vec<String>
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
.
sourcepub fn get_crate_object_file(
&self,
crate_module_file_name: &str
) -> Option<FileRef>
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 precedingCrateType
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”.
sourcepub fn write_crate_object_file(
&self,
crate_object_file_name: &str,
content: &[u8]
) -> Result<FileRef, &'static str>
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 precedingCrateType
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
impl Clone for NamespaceDir
source§fn clone(&self) -> NamespaceDir
fn clone(&self) -> NamespaceDir
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for NamespaceDir
impl Debug for NamespaceDir
Auto Trait Implementations§
impl !RefUnwindSafe for NamespaceDir
impl Send for NamespaceDir
impl Sync for NamespaceDir
impl Unpin for NamespaceDir
impl !UnwindSafe for NamespaceDir
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
Mutably borrows from an owned value. Read more