plut-core 2.11.1

Project model, run context and diagnostics for Plut
Documentation
//! How a plain tree assigns a run context.

use serde::Deserialize;

/// How a plain tree assigns a run context.
///
/// The default is `suffixes`: only `.server.luau` and `.client.luau` set a context, so a
/// generic Luau tree is not treated as a Roblox game by accident. `paths` also reads
/// `ServerScriptService`, `src/server`, `src/client` and `src/shared`, for a Roblox tree
/// that has no Rojo project file.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default, Deserialize)]
#[serde(rename_all = "lowercase")]
pub enum Contexts {
    #[default]
    Suffixes,
    Paths,
}

impl Contexts {
    /// The lowercase name used in configuration and output.
    #[must_use]
    pub const fn as_str(self) -> &'static str {
        match self {
            Self::Suffixes => "suffixes",
            Self::Paths => "paths",
        }
    }
}