Skip to main content

Module stdlib_metadata

Module stdlib_metadata 

Source
Expand description

Structured metadata declared in stdlib HarnDoc blocks.

Every public stdlib function is expected to carry five fields above its pub fn declaration:

/**
 * Returns the contents of `path`.
 *
 * @effects: [fs.read]
 * @allocation: heap
 * @errors: [FileNotFound, PermissionDenied]
 * @api_stability: stable
 * @example: let s = fs::read_to_string(harness.fs, "/x")
 */
pub fn read_to_string(...) -> ... { ... }

These fields drive harn graph --json, LSP hover, and the HARN-STD-101 lint that enforces coverage on stdlib sources.

Structs§

StdlibMetadata
One declared metadata field on a stdlib function. Empty lists and missing fields are distinct: effects: Some(vec![]) records an explicit [] declaration (“statically certified pure”), while effects: None means the author has not annotated the function yet.

Functions§

parse_for_span
Extract a canonical /** ... */ block immediately above the given span and parse its metadata fields. Returns the parsed metadata even if no fields are declared so callers can detect “doc present, fields missing”.
parse_from_doc_body
Parse all @key: value fields from the body of a canonical /** ... */ HarnDoc block. The body should be the inner text with /**, leading *, and */ markers already stripped, one line per element. Multi-line @example: continuations are joined while preserving trailing newlines.