Enum crate_metadata::CrateType
source · pub enum CrateType {
Kernel,
Application,
Userspace,
Executable,
}
Expand description
The type of a crate, based on its object file naming convention. This naming convention is only used for crate object files that come from bootloader-provided modules, which the Theseus makefile assigns at build time.
See the from_module_name()
function for more.
Variants§
Implementations§
source§impl CrateType
impl CrateType
sourcepub fn default_namespace_name(&self) -> &'static str
pub fn default_namespace_name(&self) -> &'static str
Returns the string suffix for use as the name of the crate object file’s containing namespace.
sourcepub fn from_module_name(
module_name: &str
) -> Result<(CrateType, &str, &str), &'static str>
pub fn from_module_name( module_name: &str ) -> Result<(CrateType, &str, &str), &'static str>
Returns a tuple of (CrateType, &str, &str) based on the given module_name
, in which:
- the
CrateType
is based on the first character, - the first
&str
is the namespace prefix, e.g.,"sse"
in"k_sse#..."
, - the second
&str
is the rest of the module file name after the prefix delimiter"#"
.
Examples
let result = CrateType::from_module_name("k#my_crate.o");
assert_eq!(result, (CrateType::Kernel, "", "my_crate.o") );
let result = CrateType::from_module_name("ksse#my_crate.o");
assert_eq!(result, (CrateType::Kernel, "sse", "my_crate.o") );
Trait Implementations§
source§impl PartialEq<CrateType> for CrateType
impl PartialEq<CrateType> for CrateType
impl StructuralPartialEq for CrateType
Auto Trait Implementations§
impl RefUnwindSafe for CrateType
impl Send for CrateType
impl Sync for CrateType
impl Unpin for CrateType
impl UnwindSafe for CrateType
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