Skip to main content

Module crate_config

Module crate_config 

Source
Expand description

Crate-level #[miniextendr] defaults read from the user crate’s manifest.

Proc-macro invocations share no state, so a default meant for every #[miniextendr] item in a crate cannot be declared on one macro call: miniextendr_init! expands with no knowledge of the functions and vice versa. The one place every expansion can see is the manifest. Cargo sets CARGO_MANIFEST_DIR for the crate being compiled and the proc macro runs inside that rustc process, so it can read Cargo.toml at expansion time. Cargo refingerprints a package when its manifest changes, so an edit takes effect on the next build with no stale expansions.

Supported spelling (the table header; dotted keys under [package] or [package.metadata] are accepted too, inline tables are rejected):

[package.metadata.miniextendr]
noexport_postfix = "_impl"
source_tags = true
call_attribution = "caller"
conversion_error_class = ["pkg_error_argument", "pkg_error"]
preconditions = false
roxygen_prose_links = "keep"

The reader is a deliberately small line-based scanner rather than a TOML dependency: the macro crate ships in every downstream build, and the only values it needs are strings, booleans and a single-line string array under one well-known table.

StructsΒ§

CrateConfig πŸ”’
Crate-wide defaults declared under [package.metadata.miniextendr].
CrateConfigError πŸ”’
A malformed [package.metadata.miniextendr] entry, reported as a compile error on the #[miniextendr] item that tried to use it.

ConstantsΒ§

CALL_ATTRIBUTION_KEY πŸ”’
Dotted path of the call_attribution key.
CONVERSION_ERROR_CLASS_KEY πŸ”’
Dotted path of the conversion_error_class key.
FRAMEWORK_ERROR_CLASSES πŸ”’
The classes the R raise helper appends to every Rust error. A crate-level class naming one of them would duplicate a layer of the vector.
NOEXPORT_POSTFIX_KEY πŸ”’
Dotted path of the noexport_postfix key.
PRECONDITIONS_KEY πŸ”’
Dotted path of the preconditions key.
ROXYGEN_PROSE_LINKS_KEY πŸ”’
Dotted path of the roxygen_prose_links key.
SOURCE_TAGS_KEY πŸ”’
Dotted path of the source_tags key.
TABLE_KEY πŸ”’
Dotted path of the table itself, used to reject the inline-table spelling.

FunctionsΒ§

conversion_error_class πŸ”’
The crate-level classes of argument-conversion conditions (conversion_error_class), empty when unset.
crate_config πŸ”’
The crate config for the crate currently being compiled.
crate_config_for_dir πŸ”’
crate_config for an explicit manifest directory (the cached entry point).
normalize_key πŸ”’
Collapse a dotted key or table header to a.b.c: trims each segment and strips one layer of quotes so [ "package" . metadata ] compares equal to [package.metadata].
parse_bool_value πŸ”’
Parse a TOML boolean, allowing a trailing # comment.
parse_crate_config πŸ”’
Parse the [package.metadata.miniextendr] table out of manifest text.
parse_string_array_value πŸ”’
Parse a single-line TOML array of strings (["a", 'b'], a trailing comma and a trailing # comment allowed), each element under the parse_string_value rules. Multi-line arrays and non-string elements return None.
parse_string_value πŸ”’
Parse a single-line TOML basic ("...") or literal ('...') string.
preconditions_default πŸ”’
The crate default of the type-derived R-side checks (preconditions), None when unset.
read_crate_config πŸ”’
Read and parse one manifest. Missing or unreadable files yield the defaults.
roxygen_prose_links πŸ”’
What leading doc-comment prose does with its [...] links (roxygen_prose_links), ProseLinks::Strip when unset.
source_tags_enabled πŸ”’
Whether generated roxygen blocks carry @source provenance tags.
validate_conversion_error_class πŸ”’
conversion_error_class must name at least one class, each non-empty, distinct, and not one of the framework’s own layers (rust_error, simpleError, error, condition), which are always appended.
validate_noexport_postfix πŸ”’
Mirror of miniextendr_fn::validate_postfix for the manifest value.