MCPcopy Create free account
hub / github.com/LPC4/Full-Stack / infer_target_mode_for_source

Function infer_target_mode_for_source

src/target_mode.rs:10–24  ·  view source on GitHub ↗
(
    source: &str,
    is_stdlib: bool,
    fallback: TargetMode,
)

Source from the content-addressed store, hash-verified

8}
9
10pub fn infer_target_mode_for_source(
11 source: &str,
12 is_stdlib: bool,
13 fallback: TargetMode,
14) -> TargetMode {
15 if is_stdlib {
16 TargetMode::Hosted
17 } else if source_declares_entry(source, "kmain") {
18 TargetMode::Kernel
19 } else if source_declares_entry(source, "main") {
20 TargetMode::Hosted
21 } else {
22 fallback
23 }
24}
25
26#[cfg(test)]
27mod tests {

Calls 1

source_declares_entryFunction · 0.85