Skip to main content

Crate stylex_macros

Crate stylex_macros 

Source

Modules§

collection_macros
Collection and iteration helper macros.
conversion_macros
Conversion and type extraction macros for safe value unwrapping.
panic_macros
Error handling macros for consistent error handling across the workspace.
stylex_error
Structured error types and formatting for StyleX diagnostics.

Macros§

as_expr_or_err
Macro to unwrap an Option to Expr or return an error. Returns the expression on success, or returns Err(anyhow::Error) on failure.
as_expr_or_opt_err
Macro to unwrap an Option to Expr for functions returning Option. Returns the expression on success, or returns Some(Err(anyhow::Error)) on failure.
as_expr_or_panic
Macro to unwrap an Option to Expr for functions returning primitives. Returns the expression on success, or panics with the error message on failure.
collect_confident
Collects an evaluation result if it’s confident, otherwise returns None.
convert_expr_to_str_or_err
Macro to safely convert an expression to a string with error Result handling. Returns the string on success, or returns Err(anyhow::Error) on failure.
stylex_anyhow
Like anyhow::anyhow!() but wraps in StyleXError.
stylex_bail
Like anyhow::bail!() but wraps the error in StyleXError.
stylex_panic
Like panic!() but produces [StyleX] <message>.
stylex_panic_with_file
stylex_unimplemented
Like unimplemented!() but produces [StyleX] [UNIMPLEMENTED] <message>.
stylex_unreachable
Like unreachable!() but produces [StyleX] [UNREACHABLE] <message>.
stylex_unwrap
Unwrap a Result or panic with a [StyleX] prefixed message.
unwrap_or_panic
Macro to unwrap a Result or panic with the error message. This is a cleaner replacement for .unwrap_or_else(|error| panic!("{}", error)).