Module util

Source
Expand description

Utility macros and hint functions.

Extends: std::{hint}


Macros§

CONST
A helper for constructing macro constants.
assert
core Asserts that a boolean expression is true at runtime.
assert_approx_eq_all
Asserts the approximate equality of a series of expressions within tolerance.
assert_eq
core Asserts that two expressions are equal to each other.
assert_eq_all
Asserts the equality of a series of expressions.
assert_ne
core Asserts that two expressions are not equal to each other.
capture_first
Captures the first token from a list of inputs.
capture_last
Captures the last token from a list of inputs.
capture_tail_tuple
Captures all the tokens except the first one, as a tuple.
cdbgstd
customizable dbg! macro.
cfg
core Evaluates boolean combinations of configuration flags at compile-time.
cfg_if
A macro for defining #[cfg] if-else statements.
cfor
A for loop that is usable in compile-time contexts.
cif
devela_macros Evaluates to either a true of false literal based on the predicate.
coalesce
devela_macros Returns the first non-empty argument.
code_column
core Expands to the column number at which it was invoked.
code_file
core Expands to the file name at which it was invoked.
code_line
core Expands to the line number at which it was invoked.
code_module
core Expands to a string representing the current module path.
concat
core Concatenates literals into a static string slice.
const_assert
Asserts various comparisons on constants.
debug_assert
core Asserts that a boolean expression is true at runtime.
debug_assert_eq
core Asserts that two expressions are equal to each other.
debug_assert_ne
core Asserts that two expressions are not equal to each other.
deprecate_feature
Configures a feature as deprecated, warning if it is enabled.
enumint
devela_macros Generates a unit-only enum with variants associated to a specified range.
enumset_bit_·
Defines an enum and an associated type set of its variants.
field_of
devela_macros Generates an expression for accessing a field of a tuple or struct.
ident_const_index
Defines a constant for every given identifier with a value of its index in the list.
ident_total
devela_macros Returns the total number of identifiers in its input.
ident_total_unique
devela_macros Returns the numbers of both total and unique identifiers in its input.
ident_unique
devela_macros Returns the number of unique identifiers in its input.
iif
inline if macro.
impl_trait
A helper macro to concisely implement a few common utility traits.
include
core Parses a file as an expression or an item according to the context.
include_bytes
core Includes a file as a reference to a byte array.
include_from
Includes a Rust source file relative to the project’s directory.
include_str
core Includes a UTF-8 encoded file as a string.
items
Groups items together and expands them as if they were written directly.
maybe
Helper for using optionally implemented traits, like Default or Clone.
mod_from
Declares a module by including a Rust source file relative to the project’s directory.
paste
paste Allows to paste identifiers together.
sf
skip formatting wrapper macro.
stringify
core Stringifies its arguments.
unroll_unroll
Unrolls the given for loop.

Functions§

assert_unchecked
core Makes a soundness promise to the compiler that the condition holds.
black_box
core Hints the compiler to be maximally pessimistic about what black_box could do.
spin_loop
core Signals the processor that it is running in a busy-wait spin-loop.
unreachable_unchecked
core Informs the compiler that the current calling site is not reachable.

Attribute Macros§

compile
devela_macros Conditionally compiles the thing it is attached to based on the predicate.
compile_attr
devela_macros Conditionally compiles the given attributes based on the predicate.
autodiffExperimentalnightly_autodiff
core Automatic Differentiation macro.