pub trait SizeLimit {
    // Required methods
    fn add(&mut self, n: u64) -> Result<()>;
    fn limit(&self) -> Option<u64>;
}
Expand description

A trait for stopping serialization and deserialization when a certain limit has been reached.

Required Methods§

source

fn add(&mut self, n: u64) -> Result<()>

Tells the SizeLimit that a certain number of bytes has been read or written. Returns Err if the limit has been exceeded.

source

fn limit(&self) -> Option<u64>

Returns the hard limit (if one exists)

Implementors§