Rust

runtime

Module

Runtimes: Runtime, the eleven built-in runtimes, the Strategy that decides what the inputs are, and the RuntimeDetector.

Contents

use utopia_detector::RuntimeDetector;
Rust
pub struct RuntimeDetector

Finds the runtime of a project: the first option, in the order they were added, that matches an input the way the Strategy says.

Rust
use utopia_detector::{Node, Php, RuntimeDetector, Strategy};

let mut detector = RuntimeDetector::new(Strategy::Extension, "yarn");
detector.add_option(Php).add_option(Node);
detector.add_input("src/main.ts").add_input("Dockerfile");

let runtime = detector.detect().expect("a runtime");
assert_eq!(runtime.name(), "node");
assert_eq!(runtime.commands(), "yarn install");
Also implements Debug.
use utopia_detector::Strategy;
Rust
pub enum Strategy

What a RuntimeDetector's inputs are, and so how they are matched.

use utopia_detector::Runtime;
Rust
pub trait Runtime: Send + Sync

A language runtime, recognised by its languages, file extensions or files.