# State machines with lib, expected lifetime parameter

**URL:** https://users.rust-lang.org/t/state-machines-with-lib-expected-lifetime-parameter/29131
**Category:** help
**Created:** [June 9, 2019, 7:45pm UTC](https://users.rust-lang.org/t/state-machines-with-lib-expected-lifetime-parameter/29131 "2019-06-09T19:45:02Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![paziv](https://avatars.discourse-cdn.com/v4/letter/p/ba9def/32.png) [@paziv](https://users.rust-lang.org/u/paziv)
#### Post date: [June 9, 2019, 10:55pm UTC](https://users.rust-lang.org/t/state-machines-with-lib-expected-lifetime-parameter/29131/2 "2019-06-09T22:55:59Z")

</div>

Apparently manually implementing an enum helps.

```rust
pub struct DropItem<'a> {
	bang: &'a mut Bang,
}

pub enum WeightMessages<'a> {
	DropItem(DropItem<'a>),
	TakeItem(TakeItem),
}

```

This works, but I have to write everything by hand, so I guess this is something the lib could support in future. I'll file a ticket...

---

_[View the full topic](https://users.rust-lang.org/t/state-machines-with-lib-expected-lifetime-parameter/29131)._
