Crate rusty_typesh

Crate rusty_typesh 

Source
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§

TypeMatcher
A concrete type matcher implementation.

Traits§

TypePattern
A trait for implementing type pattern matching behavior.

Functions§

match_type
Matches a value against a series of type patterns and handlers.