Expand description
Type pattern matching system for Rust.
This crate provides a flexible type pattern matching system that allows:
- Runtime type checking and matching
- Pattern matching with custom handlers
- Both macro-based and manual matching approaches
§Examples
use rusty_typesh::type_match;
let value = 42i32;
let result = type_match!(
value,
i32 => |x: &i32| format!("Got integer: {}", x),
String => |x: &String| format!("Got string: {}", x)
);
assert_eq!(result, Some("Got integer: 42".to_string()));Macros§
- type_
match - Matches a value against multiple type patterns using a convenient macro syntax.
Structs§
- Type
Matcher - A concrete type matcher implementation.
Traits§
- Type
Pattern - A trait for implementing type pattern matching behavior.
Functions§
- match_
type - Matches a value against a series of type patterns and handlers.