1#![forbid(unsafe_code)]
26#![cfg_attr(
28 not(test),
29 deny(
30 clippy::unwrap_used,
31 clippy::expect_used,
32 clippy::panic,
33 clippy::todo,
34 clippy::unimplemented,
35 clippy::unreachable,
36 clippy::indexing_slicing
37 )
38)]
39
40pub mod budget;
41pub mod classid;
42pub mod codec;
43pub mod config;
44pub mod container;
45mod counters;
46pub mod detect;
47pub mod env;
48pub mod error;
49pub mod files;
50pub mod limits;
51pub mod object;
52pub mod objmode;
53pub mod once;
54pub mod options;
55pub mod pin;
56pub mod provider;
57pub mod pyfloat;
58pub mod pystr;
59pub mod raw;
60pub mod stream;
61pub mod tables;
62#[cfg(feature = "test-counters")]
63pub mod testing;
64pub mod typetree;
65pub mod value;
66pub mod version;
67pub mod walk;
68pub mod zip;
69
70pub use bytes::Bytes;
71pub use error::{Error, LimitError, LimitKind, NotFound, Unsupported};
72pub use files::{BundleFile, File, RawFile, SerializedFile, WebFile};
73pub use object::ObjectRef;
74pub use options::FileContext;
75pub use raw::RawStr;
76pub use value::{Built, Map, Parsed, PrimArray, PrimRun, ReadBy, Value, ValueBuilder};
77pub use version::UnityVersion;
78
79pub const VERSION: &str = env!("CARGO_PKG_VERSION");
81
82pub(crate) const fn send_sync<T: Send + Sync + ?Sized>() {}
85
86const _: () = {
92 send_sync::<budget::Reservation>();
94 send_sync::<budget::BudgetExceeded>();
95 send_sync::<budget::Counting>();
96 send_sync::<budget::DecodeBuf>();
97 send_sync::<budget::Permit>();
98 send_sync::<budget::Unbounded>();
99 send_sync::<dyn budget::MemoryBudget>();
100 send_sync::<dyn budget::PermitHome>();
101 send_sync::<codec::Codec>();
103 send_sync::<codec::Codecs>();
104 send_sync::<dyn codec::BlockCodec>();
105 send_sync::<codec::Decoded>();
106 send_sync::<dyn codec::BlockDecryptor>();
107 send_sync::<container::Container>();
109 send_sync::<container::ContainerRow>();
110 send_sync::<detect::DetectError>();
111 send_sync::<detect::FileType>();
112 send_sync::<detect::ParsedAs>();
113 send_sync::<env::LoadMode>();
115 send_sync::<env::Source>();
116 send_sync::<env::EnvOptions>();
117 send_sync::<env::EnvStats>();
118 send_sync::<env::Environment>();
119 send_sync::<dyn env::CabResolver>();
120 send_sync::<dyn env::Fetch>();
121 send_sync::<env::pptr::DerefError>();
122 send_sync::<env::pptr::ExternalIndexError>();
123 send_sync::<env::pptr::PPtr>();
124 send_sync::<env::registry::Cab>();
125 send_sync::<env::registry::Keys<'static>>();
126 send_sync::<env::registry::RawCab>();
127 send_sync::<env::registry::Registry>();
128 send_sync::<error::Error>();
130 send_sync::<error::LimitKind>();
131 send_sync::<error::NotFound>();
132 send_sync::<error::Unsupported>();
133 send_sync::<error::LimitError>();
134 send_sync::<files::bundle::LayoutKind>();
136 send_sync::<files::bundle::BlockInfo>();
137 send_sync::<files::bundle::BundleFile>();
138 send_sync::<files::bundle::BundleHeader>();
139 send_sync::<files::bundle::DirEntry>();
140 send_sync::<files::bundle::FileSlot>();
141 send_sync::<files::File>();
142 send_sync::<files::ParentKind>();
143 send_sync::<files::Parent>();
144 send_sync::<files::RawFile>();
145 send_sync::<files::serialized::External>();
146 send_sync::<files::serialized::ObjectInfo>();
147 send_sync::<files::serialized::ScriptRef>();
148 send_sync::<files::serialized::SerializedFile>();
149 send_sync::<files::serialized::SerializedHeader>();
150 send_sync::<files::serialized::SerializedType>();
151 send_sync::<files::web::WebPacker>();
152 send_sync::<files::web::WebFile>();
153 send_sync::<files::save::SaveLayout>();
154 send_sync::<files::save::SaveOptions>();
155 send_sync::<files::save::SaveError>();
156 send_sync::<limits::ChargeError>();
158 send_sync::<limits::Limits>();
159 send_sync::<once::KeptError<Error>>();
160 send_sync::<once::ResultCell<u8, Error>>();
161 send_sync::<dyn once::CellError>();
162 send_sync::<object::ObjectRef>();
163 send_sync::<options::FileContext>();
164 send_sync::<dyn config::DecryptKeySource>();
165 send_sync::<provider::TreeSource>();
166 send_sync::<provider::ProviderChain>();
167 send_sync::<provider::ProviderError>();
168 send_sync::<provider::ScriptIdent>();
169 send_sync::<provider::TreeRef>();
170 send_sync::<provider::TreeRequest<'static>>();
171 send_sync::<dyn provider::TypeTreeProvider>();
172 send_sync::<raw::RawStr>();
173 send_sync::<Bytes>();
174 send_sync::<stream::Endian>();
175 send_sync::<stream::Reader<'static>>();
176 send_sync::<typetree::rows::TreeError>();
178 send_sync::<typetree::rows::NodeId>();
179 send_sync::<typetree::rows::NodeList>();
180 send_sync::<typetree::rows::NodeRow>();
181 send_sync::<typetree::tree::Kind>();
182 send_sync::<typetree::tree::Shape>();
183 send_sync::<typetree::tree::NodeInfo>();
184 send_sync::<typetree::tree::Tree>();
185 send_sync::<value::PrimArray>();
187 send_sync::<value::Value>();
188 send_sync::<value::Map>();
189 send_sync::<value::Parsed>();
190 send_sync::<value::ValueBuilder>();
191 send_sync::<value::Built>();
192 send_sync::<value::PrimRun>();
193 send_sync::<value::ListIx>();
194 send_sync::<value::ReadBy>();
195 send_sync::<version::FlagsClass>();
196 send_sync::<version::VersionError>();
197 send_sync::<version::VersionSource>();
198 send_sync::<version::ResolvedVersion>();
199 send_sync::<version::UnityVersion>();
200 send_sync::<version::VersionPolicy>();
201 send_sync::<walk::FloatMode>();
203 send_sync::<walk::L2Kind>();
204 send_sync::<walk::ParseError>();
205 send_sync::<walk::ReadDetail>();
206 send_sync::<walk::ReadErrorKind>();
207 send_sync::<walk::RefTypes<'static>>();
208 send_sync::<walk::WriteError>();
209 send_sync::<walk::WriteRules>();
210 send_sync::<walk::ReadCtx<'static>>();
211 send_sync::<walk::ReadError>();
212 send_sync::<walk::ReadOptions>();
213 send_sync::<walk::WriteCtx<'static>>();
214 send_sync::<walk::emit::Emitted<()>>();
215 send_sync::<walk::emit::Run<'static>>();
216 send_sync::<walk::emit::Scalar>();
217 send_sync::<dyn walk::emit::Sink<Obj = ()> + Send + Sync>();
220 send_sync::<dyn walk::emit::Elements + Send + Sync>();
222};
223
224#[cfg(test)]
225mod tests {
226 use std::path::Path;
227
228 #[test]
235 fn every_public_type_is_asserted() {
236 let src = Path::new(env!("CARGO_MANIFEST_DIR")).join("src");
237 let missing = unityrs_testkit::public_types::unasserted(&src);
238 assert!(missing.is_empty(), "not asserted Send + Sync: {missing:?}");
239 }
240
241 #[test]
246 fn the_core_starts_no_thread_and_never_waits() {
247 let src = Path::new(env!("CARGO_MANIFEST_DIR")).join("src");
248 let found = unityrs_testkit::waits::waits(&src);
249 assert!(
250 found.is_empty(),
251 "the core waits or starts a thread: {found:?}"
252 );
253 }
254
255 #[test]
261 fn every_cell_is_filled_through_the_once_helper() {
262 let src = Path::new(env!("CARGO_MANIFEST_DIR")).join("src");
263 let found = unityrs_testkit::waits::cell_fills(&src);
264 assert!(
265 found.is_empty(),
266 "a cell filled outside the once helper: {found:?}"
267 );
268 }
269}