plushie/config

Project-level plushie configuration from gleam.toml.

Reads the [plushie] section of the project’s gleam.toml to provide per-project defaults for build and download commands. CLI flags always override config values.

plushie_rust_version is a root-level key. It pins the plushie-rust release used by build and download tooling.

Supported keys

[plushie]
artifacts = ["bin", "wasm"]       # which artifacts to install
bin_file = "build/my-binary"      # binary destination
wasm_dir = "static/wasm"          # WASM output directory
source_path = "/path/to/renderer" # Rust source checkout
native_widgets = ["native/gauge|gauge::GaugeExtension::new()"]

Each native_widgets entry is "crate_path|constructor_expression". The | separator is unambiguous (not valid in paths or Rust identifiers in this context). The array must be on a single line (the TOML parser does not support multi-line arrays).

Resolution order (highest priority first)

  1. CLI flag (--bin-file, --wasm-dir)
  2. [plushie] section in gleam.toml
  3. Environment variable (PLUSHIE_RUST_SOURCE_PATH)
  4. Hardcoded default

Types

Configuration for a native widget crate.

pub type NativeWidgetConfig {
  NativeWidgetConfig(crate_path: String, constructor: String)
}

Constructors

  • NativeWidgetConfig(crate_path: String, constructor: String)

Values

pub fn get_artifacts() -> Result(List(String), Nil)

Read the artifacts list from gleam.toml. Returns the list of artifact names (e.g. [“bin”, “wasm”]).

pub fn get_native_widgets() -> List(NativeWidgetConfig)

Read native widget entries from gleam.toml.

Each entry is a string in the format “crate_path|constructor”. Returns an empty list if no native_widgets key is present.

pub fn get_string(key: String) -> Result(String, Nil)

Read a string value from the [plushie] section of gleam.toml.

pub fn missing_plushie_rust_version_message() -> String

Message shown when the root-level plushie_rust_version key is missing.

pub fn plushie_rust_version() -> Result(String, Nil)

Read the plushie_rust_version root-level key from gleam.toml.

This value pins the plushie-rust release the SDK expects. Used by build and download tooling to negotiate the matching cargo-plushie and to embed into the generated renderer workspace.

pub fn wants_artifact(name: String) -> Result(Bool, Nil)

Check if a specific artifact is configured.

Search Document