#![cfg_attr(docsrs, feature(doc_cfg))]
mod binu64count;
mod binu64size;
mod binusizecount;
mod binusizesize;
mod boolean;
mod decu64count;
mod decu64size;
mod decusizecount;
mod decusizesize;
mod dur;
mod err;
mod percent;
mod relabslim;
mod select;
mod str;
use std::str::FromStr;
pub use {
binu64count::BinU64Count, binu64size::BinU64Size,
binusizecount::BinUsizeCount, binusizesize::BinUsizeSize, boolean::Bool,
decu64count::DecU64Count, decu64size::DecU64Size,
decusizecount::DecUsizeCount, decusizesize::DecUsizeSize, dur::Dur,
err::Error, percent::Percent, relabslim::RelAbsLim, select::Select,
str::Str
};
pub trait StrVal: AsRef<str> + FromStr {
type Type;
fn set(&mut self, sval: &str) -> Result<Self::Type, Error>;
fn get(&self) -> Self::Type;
fn val_str(&self) -> Option<String>;
fn get_str_vals(&self) -> (String, Option<String>);
}
pub trait Controller {
type Type;
fn def() -> String;
fn validate(val: &Self::Type) -> Result<(), Error>;
}
#[derive(Clone, Debug)]
pub struct AnyU64;
impl Controller for AnyU64 {
type Type = u64;
fn def() -> String {
String::from("0")
}
fn validate(_val: &Self::Type) -> Result<(), Error> {
Ok(())
}
}
#[derive(Clone, Debug)]
pub struct AnyUsize;
impl Controller for AnyUsize {
type Type = usize;
fn def() -> String {
String::from("0")
}
fn validate(_val: &Self::Type) -> Result<(), Error> {
Ok(())
}
}