2019-06-11 08:06:15 +00:00
|
|
|
use self::BlsSetting::*;
|
|
|
|
use crate::error::Error;
|
|
|
|
use serde_repr::Deserialize_repr;
|
|
|
|
|
2022-07-15 07:31:19 +00:00
|
|
|
#[derive(Deserialize_repr, Debug, Clone, Copy, Default)]
|
2019-06-11 08:06:15 +00:00
|
|
|
#[repr(u8)]
|
|
|
|
pub enum BlsSetting {
|
2022-07-15 07:31:19 +00:00
|
|
|
#[default]
|
2019-06-11 08:06:15 +00:00
|
|
|
Flexible = 0,
|
|
|
|
Required = 1,
|
|
|
|
Ignored = 2,
|
|
|
|
}
|
|
|
|
|
|
|
|
impl BlsSetting {
|
|
|
|
/// Check the BLS setting and skip the test if it isn't compatible with the crypto config.
|
|
|
|
pub fn check(self) -> Result<(), Error> {
|
|
|
|
match self {
|
|
|
|
Flexible => Ok(()),
|
|
|
|
Required if !cfg!(feature = "fake_crypto") => Ok(()),
|
|
|
|
Ignored if cfg!(feature = "fake_crypto") => Ok(()),
|
2019-06-12 05:47:32 +00:00
|
|
|
_ => Err(Error::SkippedBls),
|
2019-06-11 08:06:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|