Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add accessor methods for destructuring CtlValue #57

Merged
merged 1 commit into from
Nov 29, 2022

Conversation

asomers
Copy link
Contributor

@asomers asomers commented Nov 25, 2022

For example, these methods shorten

if let CtlValue::Temperature(t) = value {
    ...
}

into

let t = value.as_temperature().unwrap();

For example, these methods shorten
```rust
if let CtlValue::Temperature(t) = value {
    ...
}
```
into
```rust
let t = value.as_temperature().unwrap();
```
@johalun
Copy link
Owner

johalun commented Nov 29, 2022

This is neat, thank you! I did not know about the enum-as-inner crate.

@johalun johalun merged commit de34fe2 into johalun:master Nov 29, 2022
@asomers asomers deleted the enum-inner branch November 29, 2022 14:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants