mirror of
https://github.com/edera-dev/sprout.git
synced 2025-12-20 05:50:16 +00:00
chore(code): move crates/sprout to crates/boot and name it edera-sprout-boot
This commit is contained in:
19
crates/boot/src/extractors.rs
Normal file
19
crates/boot/src/extractors.rs
Normal file
@@ -0,0 +1,19 @@
|
||||
use crate::context::SproutContext;
|
||||
use alloc::rc::Rc;
|
||||
use alloc::string::String;
|
||||
use anyhow::{Result, bail};
|
||||
use edera_sprout_config::extractors::ExtractorDeclaration;
|
||||
|
||||
/// The filesystem device match extractor.
|
||||
pub mod filesystem_device_match;
|
||||
|
||||
/// Extracts the value using the specified `extractor` under the provided `context`.
|
||||
/// The extractor must return a value, and if a value cannot be determined, an error
|
||||
/// should be returned.
|
||||
pub fn extract(context: Rc<SproutContext>, extractor: &ExtractorDeclaration) -> Result<String> {
|
||||
if let Some(filesystem) = &extractor.filesystem_device_match {
|
||||
filesystem_device_match::extract(context, filesystem)
|
||||
} else {
|
||||
bail!("unknown extractor configuration");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user