Struct duration_in_ms::DurationInmsValidator
source · pub struct DurationInmsValidator {
pub min: DurationInms,
pub default: DurationInms,
pub max: DurationInms,
}
Fields§
§min: DurationInms
§default: DurationInms
§max: DurationInms
Implementations§
source§impl DurationInmsValidator
impl DurationInmsValidator
pub const fn new(minimal_ms: u64, default_ms: u64, maximal_ms: u64) -> Self
sourcepub fn parse_and_validate(
&self,
duration: &str
) -> Result<DurationInms, DurationError>
pub fn parse_and_validate(
&self,
duration: &str
) -> Result<DurationInms, DurationError>
To be used as a validate_parser for clap
ⓘ
validate_parser = {|lifetime: &str|duration_range.parse_and_validate(lifetime)}
Errors
Will return Err
if duration is not within the given range
permission to read it.
pub fn contains(&self, duration: &DurationInms) -> bool
Trait Implementations§
source§impl Default for DurationInmsValidator
impl Default for DurationInmsValidator
source§fn default() -> DurationInmsValidator
fn default() -> DurationInmsValidator
Returns the “default value” for a type. Read more
source§impl Display for DurationInmsValidator
impl Display for DurationInmsValidator
source§impl From<&DurationInmsValidator> for (String, String, String)
impl From<&DurationInmsValidator> for (String, String, String)
source§fn from(duration: &DurationInmsValidator) -> Self
fn from(duration: &DurationInmsValidator) -> Self
Converts to this type from the input type.
source§impl From<&DurationInmsValidator> for (u64, u64, u64)
impl From<&DurationInmsValidator> for (u64, u64, u64)
source§fn from(duration: &DurationInmsValidator) -> Self
fn from(duration: &DurationInmsValidator) -> Self
Converts to this type from the input type.
source§impl Parse for DurationInmsValidator
impl Parse for DurationInmsValidator
fn parse(input: ParseStream<'_>) -> Result<Self>
source§impl TryFrom<(DurationInms, DurationInms, DurationInms)> for DurationInmsValidator
impl TryFrom<(DurationInms, DurationInms, DurationInms)> for DurationInmsValidator
§type Error = DurationError
type Error = DurationError
The type returned in the event of a conversion error.
source§fn try_from(
value: (DurationInms, DurationInms, DurationInms)
) -> Result<Self, Self::Error>
fn try_from(
value: (DurationInms, DurationInms, DurationInms)
) -> Result<Self, Self::Error>
Performs the conversion.
source§impl TryFrom<(DurationInms, DurationInms)> for DurationInmsValidator
impl TryFrom<(DurationInms, DurationInms)> for DurationInmsValidator
§type Error = DurationError
type Error = DurationError
The type returned in the event of a conversion error.
source§fn try_from(value: (DurationInms, DurationInms)) -> Result<Self, Self::Error>
fn try_from(value: (DurationInms, DurationInms)) -> Result<Self, Self::Error>
Performs the conversion.