pub struct PatternGenerator;Expand description
Generator for Rust pattern matching from C tag checks.
§Algorithm
- Detect tag check: Identify if-conditions comparing tag fields
- Extract variant info: Parse tag value and union field access
- Generate match arms: Convert if-else-if chain to match arms
- Capitalize variants: Convert C constants to PascalCase
- Add wildcard: Ensure exhaustive matching with
_arm
Implementations§
Source§impl PatternGenerator
impl PatternGenerator
Sourcepub fn transform_tag_check(&self, stmt: &HirStatement) -> String
pub fn transform_tag_check(&self, stmt: &HirStatement) -> String
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PatternGenerator
impl RefUnwindSafe for PatternGenerator
impl Send for PatternGenerator
impl Sync for PatternGenerator
impl Unpin for PatternGenerator
impl UnwindSafe for PatternGenerator
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more