plissken-core::config
Rust
Configuration for plissken projects
Structs
Section titled “Structs”struct ConfigWarning
Section titled “struct ConfigWarning”pub
Derives: Debug, Clone, Serialize
Configuration warning (non-fatal issue)
Fields
Section titled “Fields”| Name | Type | Description |
|---|---|---|
field |
String |
The config field that triggered the warning |
message |
String |
Human-readable warning message |
hint |
Option<String> |
Optional hint for resolution |
Methods
Section titled “Methods”pub
fn new(field: impl Into<String>, message: impl Into<String>) -> SelfCreate a new warning
Source
pub fn new(field: impl Into<String>, message: impl Into<String>) -> Self { Self { field: field.into(), message: message.into(), hint: None, } }with_hint
Section titled “with_hint”pub
fn with_hint(mut self, hint: impl Into<String>) -> SelfAdd a hint to the warning
Source
pub fn with_hint(mut self, hint: impl Into<String>) -> Self { self.hint = Some(hint.into()); self }struct ValidationResult
Section titled “struct ValidationResult”pub
Derives: Debug
Result of configuration validation
Fields
Section titled “Fields”| Name | Type | Description |
|---|---|---|
valid |
bool |
Whether validation passed (no errors) |
warnings |
Vec<ConfigWarning> |
Validation warnings (non-fatal) |
struct Config
Section titled “struct Config”pub
Derives: Debug, Clone, Serialize, Deserialize
Root configuration from plissken.toml
Fields
Section titled “Fields”| Name | Type | Description |
|---|---|---|
project |
ProjectConfig |
|
output |
OutputConfig |
|
rust |
Option<RustConfig> |
|
python |
Option<PythonConfig> |
|
links |
LinksConfig |
|
quality |
QualityConfig |
Methods
Section titled “Methods”from_file
Section titled “from_file”pub
fn from_file(path: &std::path::Path) -> crate::error::Result<Self>Load configuration from a plissken.toml file.
Errors:
Returns PlisskenError::ConfigNotFound if the file doesn’t exist,
PlisskenError::ConfigParse if the TOML is invalid.
Source
pub fn from_file(path: &std::path::Path) -> crate::error::Result<Self> { use crate::error::PlisskenError;
let content = std::fs::read_to_string(path).map_err(|e| { if e.kind() == std::io::ErrorKind::NotFound { PlisskenError::ConfigNotFound { path: path.to_path_buf(), } } else { PlisskenError::Io { context: format!("failed to read config file '{}'", path.display()), source: e, } } })?;
let config: Config = toml::from_str(&content).map_err(|e| PlisskenError::ConfigParse { message: e.to_string(), source: Some(e), })?;
Ok(config) }with_inferred_defaults
Section titled “with_inferred_defaults”pub
fn with_inferred_defaults(mut self, project_root: &Path) -> SelfApply inferred defaults from manifest files (Cargo.toml, pyproject.toml).
Infers project metadata from existing manifest files and fills in missing configuration values. Explicit configuration always takes precedence over inferred values.
Inferred values
project.name- From pyproject.toml [project].name or Cargo.toml [package].namerust.crates- From Cargo.toml [workspace].members or single crate rootrust.entry_point- From Cargo.toml [package].namepython.package- From pyproject.toml [project].name (with dash-to-underscore)python.source- From pyproject.toml [tool.maturin].python-source
Parameters:
| Name | Type | Description |
|---|---|---|
project_root |
&Path |
The directory containing manifest files |
Source
pub fn with_inferred_defaults(mut self, project_root: &Path) -> Self { use crate::manifest::InferredConfig;
let inferred = InferredConfig::from_directory(project_root);
// Fill in project name if empty if self.project.name.is_empty() && let Some(name) = inferred.project_name { self.project.name = name; }
// Fill in Rust config if present but incomplete if let Some(ref mut rust) = self.rust { // Fill in crates if empty if rust.crates.is_empty() && let Some(crates) = inferred.rust_crates { rust.crates = crates; } // Fill in entry_point if not set if rust.entry_point.is_none() { rust.entry_point = inferred.rust_entry_point; } }
// Fill in Python config if present but incomplete if let Some(ref mut python) = self.python { // Fill in package name if empty if python.package.is_empty() && let Some(pkg) = inferred.python_package { python.package = pkg; } // Fill in source if not set if python.source.is_none() { python.source = inferred.python_source; } }
self }validate
Section titled “validate”pub
fn validate( &self, project_root: &Path,) -> Result<ValidationResult, ConfigError>Validate configuration semantically.
Performs validation beyond TOML parsing:
- At least one language section must be configured
- version_from source file must exist
- Configured paths must exist
Returns Ok(ValidationResult) with any warnings if validation passes,
or Err(ConfigError) if validation fails.
Parameters:
| Name | Type | Description |
|---|---|---|
project_root |
&Path |
The directory containing the plissken.toml file |
Source
pub fn validate(&self, project_root: &Path) -> Result<ValidationResult, ConfigError> { let mut warnings = Vec::new();
// Must have at least one language configured if self.rust.is_none() && self.python.is_none() { return Err(ConfigError::NoLanguageConfigured); }
// Validate version_from source exists self.validate_version_source(project_root)?;
// Validate Rust configuration if let Some(ref rust_config) = self.rust { self.validate_rust_config(rust_config, project_root, &mut warnings)?; }
// Validate Python configuration if let Some(ref python_config) = self.python { self.validate_python_config(python_config, project_root, &mut warnings)?; }
Ok(ValidationResult { valid: true, warnings, }) }struct ProjectConfig
Section titled “struct ProjectConfig”pub
Derives: Debug, Clone, Serialize, Deserialize
Project metadata
Fields
Section titled “Fields”| Name | Type | Description |
|---|---|---|
name |
String |
|
version_from |
VersionSource |
struct OutputConfig
Section titled “struct OutputConfig”pub
Derives: Debug, Clone, Serialize, Deserialize
Output configuration
Fields
Section titled “Fields”| Name | Type | Description |
|---|---|---|
format |
String |
|
path |
PathBuf |
|
template |
Option<String> |
struct RustConfig
Section titled “struct RustConfig”pub
Derives: Debug, Clone, Serialize, Deserialize
Rust source configuration
Fields
Section titled “Fields”| Name | Type | Description |
|---|---|---|
crates |
Vec<PathBuf> |
|
entry_point |
Option<String> |
|
include_private |
bool |
Document items that are not pub (default: only the public API; PyO3 bindings are documented either way) |
struct PythonConfig
Section titled “struct PythonConfig”pub
Derives: Debug, Clone, Serialize, Deserialize
Python source configuration
Fields
Section titled “Fields”| Name | Type | Description |
|---|---|---|
package |
String |
The Python package name |
source |
Option<PathBuf> |
Source directory containing Python files (defaults to package name) |
auto_discover |
bool |
Automatically discover Python modules by walking the filesystem |
modules |
HashMap<String, ModuleSourceType> |
Explicit module mappings (overrides auto-discovered modules) |
include_private |
bool |
Document names that start with _ (default: only public names; __dunder__ methods are public) |
struct LinksConfig
Section titled “struct LinksConfig”pub
Derives: Debug, Clone, Serialize, Deserialize, Default
Linking configuration
Fields
Section titled “Fields”| Name | Type | Description |
|---|---|---|
dependencies |
DependencySource |
|
docs_rs_base |
String |
struct QualityConfig
Section titled “struct QualityConfig”pub
Derives: Debug, Clone, Serialize, Deserialize, Default
Quality/linting configuration
Fields
Section titled “Fields”| Name | Type | Description |
|---|---|---|
require_docstrings |
bool |
|
min_coverage |
Option<f64> |
|
fail_on_broken_links |
bool |
enum ConfigError
Section titled “enum ConfigError”pub
Configuration validation error
Variants
Section titled “Variants”NoLanguageConfiguredVersionSourceNotFoundRustCrateNotFoundPythonSourceNotFoundGitRepoNotFound
enum VersionSource
Section titled “enum VersionSource”pub
Where to get version information
Variants
Section titled “Variants”GitCargoPyproject
enum ModuleSourceType
Section titled “enum ModuleSourceType”pub
Source type for a Python module
Variants
Section titled “Variants”Pyo3Python
enum DependencySource
Section titled “enum DependencySource”pub
Where to get dependency versions
Variants
Section titled “Variants”CargoLockCargoTomlNone
Constants
Section titled “Constants”| Name | Type | Value | Description |
|---|---|---|---|
DEFAULT_OUTPUT_FORMAT |
&str |
"markdown" |
Default output format for documentation |
DEFAULT_OUTPUT_PATH |
&str |
"docs/api" |
Default output path for generated documentation |
DEFAULT_DOCS_RS_URL |
&str |
"https://docs.rs" |
Default docs.rs base URL for external links |
DEFAULT_TEMPLATE |
&str |
"mkdocs-material" |
Default SSG template name |
VERSION_SOURCE_CARGO |
&str |
"cargo" |
Version source identifier for Cargo.toml |
VERSION_SOURCE_PYPROJECT |
&str |
"pyproject" |
Version source identifier for pyproject.toml |
CARGO_MANIFEST |
&str |
"Cargo.toml" |
Cargo manifest filename |
PYPROJECT_MANIFEST |
&str |
"pyproject.toml" |
Python project manifest filename |
PLISSKEN_CONFIG |
&str |
"plissken.toml" |
Plissken configuration filename |
TEMPLATE_MKDOCS_MATERIAL |
&str |
"mkdocs-material" |
MkDocs Material template name |
TEMPLATE_MDBOOK |
&str |
"mdbook" |
mdBook template name |
TEMPLATE_STARLIGHT |
&str |
"starlight" |
Astro Starlight template name |
DEFAULT_STARLIGHT_OUTPUT_PATH |
&str |
"docs/src/content/docs/reference/api" |
Default output path for the Starlight template: a folder of the Starlight content collection |
DEFAULT_CRATES |
&str |
"." |
Default crates configuration value |
