Registry / serialization / monostate

monostate

JSON →
library1.0.2rscratesunverified

Type that deserializes only from one specific value.

# Cargo.toml [dependencies] monostate = "1.0.2"
INSTALL
IMPORT
SIG · MONOSTATE
M
monostate
serializationrustv1.0.2
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Monostate
use monostate::Monostate;

Deserialize a field that must match a specific string value.

use monostate::Monostate; use serde::Deserialize; #[derive(Deserialize)] struct Config { #[serde(deserialize_with = "Monostate::deserialize")] version: Monostate<"1.0">, } fn main() { let json = r#"{"version":"1.0"}"#; let config: Config = serde_json::from_str(json).unwrap(); println!("Config version: {:?}", config.version); }
Debug
Known issues

No known issues recorded.

Upgrade
Version history
1.0.2latest on crates.io
Audit
Dependencies

No dependency data recorded yet.

Agent activity
3 hits · last 30 days
node
2
Amazon
1
Resources
monostate — cargo add monostate · libregistry