DataSourceExt

Trait DataSourceExt 

Source
pub trait DataSourceExt: DataSource {
    // Required method
    fn expect_message<T>(&mut self) -> Result<T, Self::Error>
       where T: MessageId + UpgradeLatest;
}
Expand description

Useful functions for DataSource.

There is a blanket implementation of this trait, so that any DataSource type can use these functions.

Required Methods§

Source

fn expect_message<T>(&mut self) -> Result<T, Self::Error>

Read a specific message type from the DataSource.

This will read the message header, and if the message id matches the type T that was requested, read the message. The message will be upgraded to the latest version, and then returned.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<Src> DataSourceExt for Src
where Src: DataSource,