1#[cfg(verus_keep_ghost)]
2use vstd::prelude::*;
3
4#[derive(Debug, Clone, Copy, PartialEq, Eq)]
9#[non_exhaustive]
10#[cfg_attr(verus_keep_ghost, verus_verify)]
11pub struct Limits {
12 pub max_width: u32,
14 pub max_height: u32,
16 pub max_pixels_per_page: u64,
18 pub max_decoder_managed_memory_bytes: u64,
20 pub max_stream_bytes: u64,
22 pub max_pages: u32,
24 pub max_segments: u32,
26 pub max_symbols: u32,
28 pub max_references_per_segment: u32,
30 pub max_total_references: u64,
32 pub max_reference_graph_depth: u32,
34 pub max_nesting_depth: u32,
36 pub max_work_units: u64,
38 pub max_cumulative_decoded_bitmap_bytes: u64,
40 pub max_retained_state_bytes: u64,
42}
43
44impl Limits {
45 #[cfg_attr(verus_keep_ghost, verus_spec(out =>
46 ensures
47 out.max_width == 1_000_000,
48 out.max_height == 1_000_000,
49 out.max_pixels_per_page == 1_000_000_000,
50 out.max_decoder_managed_memory_bytes == 1_073_741_824,
51 out.max_stream_bytes == 1_073_741_824,
52 out.max_pages == 10_000,
53 out.max_segments == 100_000,
54 out.max_symbols == 1_000_000,
55 out.max_references_per_segment == 4_096,
56 out.max_total_references == 1_000_000,
57 out.max_reference_graph_depth == 128,
58 out.max_nesting_depth == 128,
59 out.max_work_units == 2_000_000_000,
60 out.max_cumulative_decoded_bitmap_bytes == 4_294_967_296,
61 out.max_retained_state_bytes == 536_870_912,
62 ))]
63 #[cfg_attr(verus_keep_ghost, allow(unused, verus_impl_method_marker))]
64 pub(crate) fn project_default() -> Self {
65 Self {
66 max_width: 1_000_000,
67 max_height: 1_000_000,
68 max_pixels_per_page: 1_000_000_000,
69 max_decoder_managed_memory_bytes: 1_073_741_824,
70 max_stream_bytes: 1_073_741_824,
71 max_pages: 10_000,
72 max_segments: 100_000,
73 max_symbols: 1_000_000,
74 max_references_per_segment: 4_096,
75 max_total_references: 1_000_000,
76 max_reference_graph_depth: 128,
77 max_nesting_depth: 128,
78 max_work_units: 2_000_000_000,
79 max_cumulative_decoded_bitmap_bytes: 4_294_967_296,
80 max_retained_state_bytes: 536_870_912,
81 }
82 }
83}
84
85#[cfg_attr(verus_keep_ghost, verifier::verify)]
86impl Default for Limits {
87 #[cfg_attr(verus_keep_ghost, verus_spec(out =>
88 ensures
89 out.max_width == 1_000_000,
90 out.max_height == 1_000_000,
91 out.max_pixels_per_page == 1_000_000_000,
92 out.max_decoder_managed_memory_bytes == 1_073_741_824,
93 out.max_stream_bytes == 1_073_741_824,
94 out.max_pages == 10_000,
95 out.max_segments == 100_000,
96 out.max_symbols == 1_000_000,
97 out.max_references_per_segment == 4_096,
98 out.max_total_references == 1_000_000,
99 out.max_reference_graph_depth == 128,
100 out.max_nesting_depth == 128,
101 out.max_work_units == 2_000_000_000,
102 out.max_cumulative_decoded_bitmap_bytes == 4_294_967_296,
103 out.max_retained_state_bytes == 536_870_912,
104 ))]
105 #[cfg_attr(verus_keep_ghost, allow(unused, verus_impl_method_marker))]
106 fn default() -> Self {
107 Self::project_default()
108 }
109}