the.bay.news

Debugging callback structs

The Rust Programming Language Forum
Debugging callback structs
I'm trying to test a struct that calls back to a listener whenever its internal state changes using an interface like this: pub struct StateDetails { id: String, name: String, info: Vec<u16>, // ... } #[cfg_attr(test, mockall::automock)] pub trait StateChangeListener: Send + Sync { fn on_state_change(&self, state: &StateDetails); } I'm using mockall to produce tests of my class. The problem I'm running into is that if I just let mock_listener = MockStateChangeListener::ne...

0 comments

Sign in to join the discussion — your thebay.events account works here.

No comments yet.