pub trait PostageWatchSenderExt<T> {
// Required methods
fn try_maybe_send<F, E>(&mut self, update: F) -> Result<(), E>
where T: PartialEq,
F: FnOnce(&T) -> Result<T, E>;
fn maybe_send<F>(&mut self, update: F)
where T: PartialEq,
F: FnOnce(&T) -> T;
}Expand description
Extension trait for some postage::watch::Sender to provide maybe_send
Ideally these, or something like them, would be upstream: See https://github.com/austinjones/postage-rs/issues/56.
We provide this as an extension trait became the implementation is a bit fiddly. This lets us concentrate on the actual logic, when we use it.
Required Methods§
Sourcefn try_maybe_send<F, E>(&mut self, update: F) -> Result<(), E>
fn try_maybe_send<F, E>(&mut self, update: F) -> Result<(), E>
Update, by calling a fallible function, sending only if necessary
Calls update on the current value in the watch, to obtain a new value.
If the new value doesn’t compare equal, updates the watch, notifying receivers.
Sourcefn maybe_send<F>(&mut self, update: F)
fn maybe_send<F>(&mut self, update: F)
Update, by calling a function, sending only if necessary
Calls update on the current value in the watch, to obtain a new value.
If the new value doesn’t compare equal, updates the watch, notifying receivers.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
Source§impl<T> PostageWatchSenderExt<T> for Sender<T>
Extension trait for some postage::watch::Sender to provide maybe_send
impl<T> PostageWatchSenderExt<T> for Sender<T>
Extension trait for some postage::watch::Sender to provide maybe_send
Ideally these, or something like them, would be upstream: See https://github.com/austinjones/postage-rs/issues/56.
We provide this as an extension trait became the implementation is a bit fiddly. This lets us concentrate on the actual logic, when we use it.
Source§fn try_maybe_send<F, E>(&mut self, update: F) -> Result<(), E>
fn try_maybe_send<F, E>(&mut self, update: F) -> Result<(), E>
Update, by calling a fallible function, sending only if necessary
Calls update on the current value in the watch, to obtain a new value.
If the new value doesn’t compare equal, updates the watch, notifying receivers.