pub use de::{from_reader, from_slice, from_str};
pub use error::{ErrorDiagnostic, Result};
mod de;
mod error;
mod path;
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn result_type_alias() {
let json = r#"42"#;
let result: Result<i32> = from_str(json);
assert!(result.is_ok());
assert_eq!(result.unwrap(), 42);
}
#[test]
fn error_diagnostic_is_send_and_sync() {
fn assert_send_sync<T: Send + Sync>() {}
let json = r#"{}"#;
let result: Result<serde_json::Value> = from_str(json);
assert!(result.is_ok());
assert_send_sync::<ErrorDiagnostic>();
}
#[test]
fn error_diagnostic_display() {
let json = r#"invalid json"#;
let result: Result<serde_json::Value> = from_str(json);
assert!(result.is_err());
let error = result.unwrap_err();
let error_string = format!("{}", error);
assert!(!error_string.is_empty());
}
}