Skip to content

Conversation

@A4-Tacks
Copy link
Member

Example

impl Adt {
    pub fn into_enum(self) -> Option<Enum> {
        if let Self::Enum(variant) = self { Some(variant) } else { None }
    }
    pub fn into_struct(self) -> Option<Struct> {
        if let Self::Struct(variant) = self { Some(variant) } else { None }
    }
    pub fn into_union(self) -> Option<Union> {
        if let Self::Union(variant) = self { Some(variant) } else { None }
    }
}

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Nov 11, 2025
Example
---
```rust
impl Adt {
    pub fn into_enum(self) -> Option<Enum> {
        if let Self::Enum(variant) = self { Some(variant) } else { None }
    }
    pub fn into_struct(self) -> Option<Struct> {
        if let Self::Struct(variant) = self { Some(variant) } else { None }
    }
    pub fn into_union(self) -> Option<Union> {
        if let Self::Union(variant) = self { Some(variant) } else { None }
    }
}
```
@A4-Tacks A4-Tacks force-pushed the syntax-into-variant branch from e65dab0 to bda4c86 Compare November 11, 2025 09:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants