1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
// =============================================================================
// Copyright (c) 2025 - 2026 Haixing Hu.
//
// SPDX-License-Identifier: Apache-2.0
//
// Licensed under the Apache License, Version 2.0.
// =============================================================================
//! Explicit Serde seed for decoding one unversioned V1 payload.
use Deserialize;
use Deserializer;
use DeserializeSeed;
use ValueWirePayloadV1;
use WireShapeOwned;
/// Explicit Serde seed for decoding one unversioned V1 payload.
///
/// Use this seed with a decoder that enforces the resource limits appropriate
/// for the surrounding document. For complete JSON input, prefer the
/// bounded JSON decode helpers on `ValueWirePayloadV1`.
///
/// With the `json` feature, use it when the surrounding protocol owns the
/// version envelope and its decoder session:
///
/// ```rust
/// # #[cfg(feature = "json")]
/// # fn main() -> Result<(), Box<dyn std::error::Error>> {
/// use qubit_budget::json::{JsonDecodeLimits, JsonDecodeSession};
/// use qubit_json::decode::JsonDecoder;
/// use qubit_value::ValueWirePayloadV1Seed;
///
/// let limits = JsonDecodeLimits::builder().max_input_bytes(256usize).build();
/// let session = JsonDecodeSession::from_limits(limits);
/// let mut decoder = JsonDecoder::new(session);
/// let payload = decoder.decode_seed_utf8(
/// ValueWirePayloadV1Seed::new(),
/// br#"{"scalar":{"int32":7}}"#,
/// )?;
/// assert_eq!(payload.into_container().data_type(), qubit_datatype::DataType::Int32);
/// # Ok(())
/// # }
/// # #[cfg(not(feature = "json"))]
/// # fn main() {}
/// ```
;