Trait Sortable

Source
pub trait Sortable<W: Write, R: Read>: Ord + Sized {
    type Error;

    // Required methods
    fn serialize(&self, w: &mut W) -> Result<(), Self::Error>;
    fn deserialize(r: &mut R) -> Option<Result<Self, Self::Error>>;
}
Expand description

Implement this trait for data to be sorted

Required Associated Types§

Source

type Error

Errors that may occur during serialization and deserialization. Note that it needs to implement From<std::io::Error>.

Required Methods§

Source

fn serialize(&self, w: &mut W) -> Result<(), Self::Error>

serialize itself and write into the writer.

Source

fn deserialize(r: &mut R) -> Option<Result<Self, Self::Error>>

read data and deserialize.

If no more items to be read, return None.

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§