/// Convenience function to create a new `ClientStateBroker` instance.
///
/// The broker is used to vend new `ClientStatePublisher` and `ClientStateSubscriber` instances.
///
/// When `ClientStatePublisher.set()` is called with a `ThermalState` value, then all pending
/// `Watch` requests registered with a corresponding `ClientStateSubscriber` (see the
/// `spawn_watcher_handler` function) will be completed with that value, regardless of whether that
/// value differs from the previous `ThermalState` that was sent to the client. Therefore, care
/// should be taken to only call `ClientStatePublisher.set()` when the `ThermalState` value has
/// actually changed in order to properly implement the hanging-get behavior.
Convenience function to create a new `ClientStateBroker` instance.
The broker is used to vend new `ClientStatePublisher` and `ClientStateSubscriber` instances.


Convenience function to create a new ` ClientStateBroker ` instance . The broker is used to vend new ` ClientStatePublisher ` and ` ClientStateSubscriber ` instances .
fn new_state_broker() -> ClientStateBroker {
    let notify_fn: StateChangeFn = Box::new(|state, responder| {
        match responder.send(state.0 as u64) {
            Ok(()) => true, // indicates that the client was successfully updated
            Err(e) => {
                error!("Failed to send thermal state to client: {}", e);
                false
            }
        }
    });
    hanging_get::HangingGet::new(ThermalState(0), notify_fn)
}
fn new_state_broker ( ) -> ClientStateBroker { let notify_fn : StateChangeFn = Box :: new ( | state , responder | { match responder . send ( state . 0 as u64 ) { Ok ( ( ) ) => true , // indicates that the client was successfully updated Err ( e ) => { error ! ( " " e ) ; false } } } ) ; hanging_get :: HangingGet :: new ( ThermalState ( 0 ) , notify_fn ) }
Convenience function to create a new `ClientStateBroker` instance.
Convenience function to create a new ` ClientStateBroker ` instance .