pub trait Requirement {
type Error;
// Required methods
fn check(&mut self, vector: Vector);
fn check_partial(&mut self, vector: Vector, len: u32);
fn result(self) -> (bool, Result<(), Self::Error>);
fn results(self) -> (bool, impl Iterator<Item = Result<(), Self::Error>>);
}
Available on crate feature
require
only.Expand description
Required Associated Types§
Required Methods§
Sourcefn check_partial(&mut self, vector: Vector, len: u32)
fn check_partial(&mut self, vector: Vector, len: u32)
Used internally by the check
function
This operates similarly to Requirement::check
but for handling partial loads.
The reason this is necessary is that partial loads pad the register with zeroes to ensure safety, if these zeroes to not meet any requirement then the validator would consider there to be illegal input and flag it as such.
§Arguments
vector
- The vector to check.len
- The length of the data so that the validator knows what to check.
Sourcefn result(self) -> (bool, Result<(), Self::Error>)
fn result(self) -> (bool, Result<(), Self::Error>)
§Result
Get the result of the requirement check. This will return the first error caught in order
of the requirements. If you need to know each unfulfilled requirement see results
§Returns
- A
bool
denoting if all bytes met at least one of the requirements. Ok(())
if all requirements were met, or the first error (in order of requirements) caught.
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.