Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- trait Alteration {
- fn method(&self);
- }
- enum State {
- Foo {var: Box<Alteration>},
- Bar {var: Box<Alteration>}
- }
- struct Uploader {
- state: State
- }
- impl Uploader {
- fn problem(&mut self) {
- let next_state = match self.state {
- State::Foo {ref var} => {
- State::Bar {
- var : *var,
- }
- }
- _ => {
- return;
- }
- };
- self.state = next_state;
- }
- }
- fn main() {
- }
Add Comment
Please, Sign In to add comment