kproc_values/
lib.rs

1#![doc = include_str!("../README.MD")]
2#![warn(missing_docs)]
3#![deny(warnings)]
4
5use std::collections::HashMap;
6
7mod error;
8pub mod graph;
9
10pub use error::Error;
11
12/// Result type for kproc_values
13pub type Result<T> = std::result::Result<T, Error>;
14
15#[cfg(feature = "schemars")]
16use schemars::JsonSchema;
17
18/// Hold a number value in the graph
19#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
20#[serde(untagged)]
21#[cfg_attr(feature = "schemars", derive(JsonSchema))]
22#[allow(missing_docs)]
23pub enum Number
24{
25  UInt(u64),
26  /// Always less than zero.
27  Int(i64),
28  /// Always finite.
29  Float(f64),
30}
31
32/// Hold a value in the graph
33#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
34#[serde(untagged)]
35#[cfg_attr(feature = "schemars", derive(JsonSchema))]
36#[allow(missing_docs)]
37pub enum Value
38{
39  Null,
40  Bool(bool),
41  Number(Number),
42  String(String),
43  #[cfg(feature = "image")]
44  Image(Image),
45  Array(Vec<Value>),
46  Object(HashMap<String, Value>),
47}
48
49#[cfg(feature = "image")]
50pub(crate) mod image;
51
52#[cfg(feature = "image")]
53pub use image::Image;