Struct dcsv::ValueLimiter
source · [−]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
sourceimpl 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
pub fn get_type(&self) -> ValueType
pub fn set_type(&mut self, column_type: ValueType)
pub fn get_default(&self) -> Option<&Value>
pub fn get_variant(&self) -> Option<&Vec<Value>>
pub fn set_variant(
&mut self,
default: Value,
variants: &[Value]
) -> DcsvResult<()>
pub fn get_pattern(&self) -> Option<&Regex>
pub fn set_pattern(&mut self, default: Value, pattern: Regex) -> DcsvResult<()>
Trait Implementations
sourceimpl Clone for ValueLimiter
impl Clone for ValueLimiter
sourcefn clone(&self) -> ValueLimiter
fn clone(&self) -> ValueLimiter
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source. Read more
sourceimpl Debug for ValueLimiter
impl Debug for ValueLimiter
sourceimpl Default for ValueLimiter
impl Default for ValueLimiter
sourcefn default() -> ValueLimiter
fn default() -> ValueLimiter
Returns the “default value” for a type. Read more
Auto Trait Implementations
impl RefUnwindSafe for ValueLimiter
impl Send for ValueLimiter
impl Sync for ValueLimiter
impl Unpin for ValueLimiter
impl UnwindSafe for ValueLimiter
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more