is_valid_data

Function is_valid_data 

Source
pub fn is_valid_data(value: &Value) -> bool
Expand description

Check if data is valid for storage in Gun

This is a convenience function that returns true if the value is either:

  • A valid simple value (validated by valid)
  • A soul reference

§Arguments

  • value - The JSON value to check

§Returns

true if the value is valid for Gun, false otherwise.

§Example

use gun::valid::is_valid_data;
use serde_json::json;

assert!(is_valid_data(&json!("hello")));
assert!(is_valid_data(&json!(42)));
assert!(is_valid_data(&json!({"#": "user_123"})));
assert!(!is_valid_data(&json!(f64::INFINITY)));