add useful validator function
Some checks failed
Rust/sat-rs/pipeline/pr-main There was a failure building this commit

This commit is contained in:
Robin Müller 2024-04-14 12:26:03 +02:00
parent ec3a53d498
commit 5746fba565
Signed by: muellerr
GPG Key ID: A649FB78196E3849

View File

@ -72,6 +72,12 @@ impl ValidatorU16Id for hashbrown::HashSet<u16> {
}
}
impl ValidatorU16Id for u16 {
fn validate(&self, id: u16) -> bool {
id == *self
}
}
impl ValidatorU16Id for [u16] {
fn validate(&self, id: u16) -> bool {
self.binary_search(&id).is_ok()