pub fn validate(&self) -> bool{
    match self {
      &Value::Integer(ref s) => {
        let p = Parser::new();
        match p.integer(s) {
           (_, IResult::Done(_, _)) => true,
           (_,_) => false,
        }
      },
      &Value::Float(ref s) => {
        let p = Parser::new();
        match p.float(s) {
           (_, IResult::Done(_, _)) => true,
           (_,_) => false,
        }
      },
      &Value::DateTime(ref dt) => {dt.validate()},
      &Value::String(ref s, st) => {
        match st {
          StrType::Basic => {
            match Parser::quoteless_basic_string(s) {
              IResult::Done(i,_) => i.len() == 0,
              _ => false,
            }
          },
          StrType::MLBasic => {
            match Parser::quoteless_ml_basic_string(s) {
              IResult::Done(i,_) => i.len() == 0,
              _ => false,
            }
          },
          StrType::Literal => {
            match Parser::quoteless_literal_string(s) {
              IResult::Done(i,_) => i.len() == 0,
              _ => false,
            }
          },
          StrType::MLLiteral => {
            match Parser::quoteless_ml_literal_string(s) {
              IResult::Done(i,_) => i.len() == 0,
              _ => false,
            }
          },
        }
      },
      _ => true,
    }
  }
/// Parses and validates a `Value`, returns true if the value is valid and false if it is invalid.
///
/// # Examples
///
/// ```
/// use tomllib::types::{Value};
///
/// assert!(!Value::Integer("_989_721_".into()).validate()); // Integers may have underscores but they must be
///                                                           // surrounded by digits
/// assert!(Value::Float("7.62".into()).validate());
/// ```
Parses and validates a `Value`, returns true if the value is valid and false if it is invalid.
Parses and validates a ` Value ` returns true if the value is valid and false if it is invalid .
pub fn validate(&self) -> bool{
    match self {
      &Value::Integer(ref s) => {
        let p = Parser::new();
        match p.integer(s) {
           (_, IResult::Done(_, _)) => true,
           (_,_) => false,
        }
      },
      &Value::Float(ref s) => {
        let p = Parser::new();
        match p.float(s) {
           (_, IResult::Done(_, _)) => true,
           (_,_) => false,
        }
      },
      &Value::DateTime(ref dt) => {dt.validate()},
      &Value::String(ref s, st) => {
        match st {
          StrType::Basic => {
            match Parser::quoteless_basic_string(s) {
              IResult::Done(i,_) => i.len() == 0,
              _ => false,
            }
          },
          StrType::MLBasic => {
            match Parser::quoteless_ml_basic_string(s) {
              IResult::Done(i,_) => i.len() == 0,
              _ => false,
            }
          },
          StrType::Literal => {
            match Parser::quoteless_literal_string(s) {
              IResult::Done(i,_) => i.len() == 0,
              _ => false,
            }
          },
          StrType::MLLiteral => {
            match Parser::quoteless_ml_literal_string(s) {
              IResult::Done(i,_) => i.len() == 0,
              _ => false,
            }
          },
        }
      },
      _ => true,
    }
  }
pub fn validate ( & self ) -> bool { match self { & Value :: Integer ( ref s ) => { let p = Parser :: new ( ) ; match p . integer ( s ) { ( _ , IResult :: Done ( _ , _ ) ) => true , ( _ , _ ) => false , } } , & Value :: Float ( ref s ) => { let p = Parser :: new ( ) ; match p . float ( s ) { ( _ , IResult :: Done ( _ , _ ) ) => true , ( _ , _ ) => false , } } , & Value :: DateTime ( ref dt ) => { dt . validate ( ) } , & Value :: String ( ref s , st ) => { match st { StrType :: Basic => { match Parser :: quoteless_basic_string ( s ) { IResult :: Done ( i , _ ) => i . len ( ) == 0 , _ => false , } } , StrType :: MLBasic => { match Parser :: quoteless_ml_basic_string ( s ) { IResult :: Done ( i , _ ) => i . len ( ) == 0 , _ => false , } } , StrType :: Literal => { match Parser :: quoteless_literal_string ( s ) { IResult :: Done ( i , _ ) => i . len ( ) == 0 , _ => false , } } , StrType :: MLLiteral => { match Parser :: quoteless_ml_literal_string ( s ) { IResult :: Done ( i , _ ) => i . len ( ) == 0 , _ => false , } } , } } , _ => true , } }
Parses and validates a `Value`, returns true if the value is valid and false if it is invalid.
Parses and validates a ` Value ` returns true if the value is valid and false if it is invalid .
&self
&self
examples
```
use tomllib::types::{Value}.

assert!(!Value::Integer("_989_721_".into()).validate()); // Integers may have underscores but they must be
surrounded by digits
assert!(Value::Float("7.62".into()).validate());
```
` ` ` use tomllib :: types :: { Value } . assert! ( !Value :: Integer ( " _989_721_ " . into () ) . validate () ) ; // Integers may have underscores but they must be surrounded by digits assert! ( Value :: Float ( " 7 . 62 " . into () ) . validate () ) ; ` ` `