Skip to main content

Framework

Trait Framework 

Source
pub trait Framework: Send + Sync {
    // Required methods
    fn name(&self) -> &str;
    fn files(&self) -> &[&str];
    fn install_command(&self, packager: &str) -> &str;
    fn build_command(&self, packager: &str) -> &str;
    fn output_directory(&self) -> &str;
    fn parents(&self) -> usize;

    // Provided methods
    fn packages(&self) -> &[&str] { ... }
    fn config_files(&self) -> &[&str] { ... }
    fn adapter(&self, config: &[u8]) -> Option<Adapter> { ... }
}
Expand description

A web framework, recognised by its configuration files and the packages a project depends on.

PHP: Utopia\Detector\Detection\Framework.

Required Methods§

Source

fn name(&self) -> &str

The framework’s name, such as nextjs.

PHP: getName().

Source

fn files(&self) -> &[&str]

The file names that reveal it, such as next.config.js.

PHP: getFiles().

Source

fn install_command(&self, packager: &str) -> &str

The command that installs dependencies with packager (npm, pnpm, yarn; anything else, or empty, as pnpm).

PHP: getInstallCommand(), with the packager setPackager() set.

Source

fn build_command(&self, packager: &str) -> &str

The command that builds with packager.

PHP: getBuildCommand(), with the packager setPackager() set.

Source

fn output_directory(&self) -> &str

Where the build writes its output, such as ./.next.

PHP: getOutputDirectory().

Source

fn parents(&self) -> usize

How many classes the framework’s PHP class extends (React extends JS, Framework and Detection: 3). When frameworks tie on matches, the one with the fewest wins: the more general framework.

PHP: the get_parent_class() chain detect() counts.

Provided Methods§

Source

fn packages(&self) -> &[&str]

The dependencies that reveal it, such as next.

PHP: getPackages().

Source

fn config_files(&self) -> &[&str]

The configuration files to read for Framework::adapter, in priority order.

PHP: getConfigFiles().

Source

fn adapter(&self, config: &[u8]) -> Option<Adapter>

How the build is served, read from a configuration file’s content, or None when it cannot tell.

PHP: getAdapter($configContent).

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§