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
73
74
75
76
77
78
79
80
81
82
83
//! Native RPC resource policy; IC Wire owns the codec and envelopes.
use Limits;
use ;
pub use Error;
/// Maximum admitted payload traversal nodes.
pub const MAX_NODES: usize = 1_048_576;
/// Maximum admitted Serde nesting, including endpoint record/container boundaries.
/// Allows the 64-level schema contract plus enum, collection and reply wrappers.
pub const MAX_DEPTH: usize = 256;
/// Browser traversal allowance for bounded interactive views.
///
/// Intentionally below native policy; large replies can require smaller pages.
/// This preserves the existing browser contract; it does not bound JS heap use.
pub const BROWSER_MAX_NODES: usize = 32_768;
/// Browser nesting allowance, intentionally below the native schema allowance.
///
/// Deep native values remain unsupported by the browser view; callers receive a
/// limit refusal rather than truncated or partially decoded output.
pub const BROWSER_MAX_DEPTH: usize = 32;
/// Conservative allocation allowance for decoded native payloads.
pub const MAX_HEAP_BYTES: usize = 256 * 1024 * 1024;
/// Maximum public reply envelope bytes.
pub const MAX_REPLY_BYTES: usize = 3 * 1024 * 1024;
/// Maximum owned endpoint request envelope bytes.
pub const MAX_REQUEST_BYTES: usize = 2 * 1024 * 1024;
/// Admission allowances for payload or complete frame bytes.
pub const
/// Allocation-free sizing policy retaining the same traversal heap allowance.
///
/// A size may exceed delivery limits so precommit callers can return the typed
/// oversized-reply error. No output buffer is allocated under this allowance.
pub const
/// Encode a native payload through IC Wire's bounded codec.
/// Measure a reply payload under the same resource limits as [`encode_one`].
///
/// This allocates no output buffer. Unlike [`encoded_len`], it refuses payloads
/// above the reply byte ceiling. Pass the same owned or borrowed value shape
/// as encoding so IC Wire applies identical traversal admission.
/// Decode one complete payload through IC Wire's bounded codec.
///
/// Maps, sets and custom visitors may normalize input; successful decoding does
/// not establish canonical ordering or uniqueness. Retain the original bytes
/// for exact retries, signatures or hashes instead of re-encoding the value.
/// Measure native payload bytes without allocating output storage.
Sized>