Skip to main content

Crate kael_util_macros

Crate kael_util_macros 

Source
Expand description

§kael_util_macros

Small procedural macros shared by Kael’s tests and performance tooling:

  • path!, uri!, and line_endings! produce target-correct literals without runtime platform branches.
  • perf marks performance-sensitive tests. Enabling the perf-enabled feature adds the metadata consumed by kael_perf; without it, the macro remains a normal test attribute.

Most application code does not need to depend on this crate directly. It is a support crate for the Kael workspace and its test infrastructure.

path! and uri! are fixture helpers, not general path or URL normalizers. They map Unix-style test literals to a C: drive on Windows while preserving explicit drive letters and UNC paths. line_endings! normalizes mixed LF/CRLF fixtures before producing the target-specific literal.

#[perf] accepts at most one importance level plus optional positive iterations: usize and weight: u8 expressions. With perf-enabled, generated benchmark tests ignore zero or malformed iteration environment values, emit the versioned kael_perf metadata protocol, and keep conditional-compilation attributes paired with their metadata tests.

See the Kael guide for framework-level usage.

§License

Licensed under the Apache License, Version 2.0.

Macros§

line_endings
This macro replaces the line endings \n with \r\n for Windows. But if the target OS is not Windows, the line endings are returned as is.
path
A macro used in tests for cross-platform path string literals in tests. On Windows it replaces / with \\ and adds C: to the beginning of absolute paths. On other platforms, the path is returned unmodified.
uri
This macro replaces the path prefix file:/// with file:///C:/ for Windows. But if the target OS is not Windows, the URI is returned as is.

Attribute Macros§

perf
Marks a test as perf-sensitive, to be triaged when checking the performance of a build. This also automatically applies #[test].