pub struct ValueLimiter { /* private fields */ }Expand description
Limiter that costraints which data that Value can hold
VaulueLimiter has four properties
- type ( Eitehr number or text )
- default value
- variants ( Range of values )
- pattern ( Regex pattern )
Implementations§
Source§impl ValueLimiter
impl ValueLimiter
Sourcepub fn is_convertible(&self, value: &Value) -> Option<ValueType>
pub fn is_convertible(&self, value: &Value) -> Option<ValueType>
Check if given value can be converted to the type of valuelimiter
Sourcepub fn from_line(attributes: &[impl AsRef<str>]) -> DcsvResult<Self>
pub fn from_line(attributes: &[impl AsRef<str>]) -> DcsvResult<Self>
Create value limiter from attributes
The order is
- Type
- Default
- Variant
- Pattern
Sourcepub fn get_default(&self) -> Option<&Value>
pub fn get_default(&self) -> Option<&Value>
Get default value from limiter
Sourcepub fn get_variant(&self) -> Option<&Vec<Value>>
pub fn get_variant(&self) -> Option<&Vec<Value>>
Return variant reference
Sourcepub fn set_variant(
&mut self,
default: Value,
variants: &[Value],
) -> DcsvResult<()>
pub fn set_variant( &mut self, default: Value, variants: &[Value], ) -> DcsvResult<()>
Set variant
Sourcepub fn get_pattern(&self) -> Option<&Regex>
pub fn get_pattern(&self) -> Option<&Regex>
Get pattern
Sourcepub fn set_pattern(&mut self, default: Value, pattern: Regex) -> DcsvResult<()>
pub fn set_pattern(&mut self, default: Value, pattern: Regex) -> DcsvResult<()>
Set pattern
Trait Implementations§
Source§impl Clone for ValueLimiter
impl Clone for ValueLimiter
Source§fn clone(&self) -> ValueLimiter
fn clone(&self) -> ValueLimiter
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ValueLimiter
impl Debug for ValueLimiter
Source§impl Default for ValueLimiter
impl Default for ValueLimiter
Source§fn default() -> ValueLimiter
fn default() -> ValueLimiter
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for ValueLimiter
impl RefUnwindSafe for ValueLimiter
impl Send for ValueLimiter
impl Sync for ValueLimiter
impl Unpin for ValueLimiter
impl UnwindSafe for ValueLimiter
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more