aienux
Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately.
Brought by drakestapleton
aienux / vendor / serde / src / core / lib.rs
| 1 | //! Serde is a framework for ***ser***ializing and ***de***serializing Rust data |
| 2 | //! structures efficiently and generically. |
| 3 | //! |
| 4 | //! The `serde_core` crate contains Serde's trait definitions with **no support |
| 5 | //! for #\[derive()\]**. |
| 6 | //! |
| 7 | //! In crates that derive an implementation of `Serialize` or `Deserialize`, you |
| 8 | //! must depend on the [`serde`] crate, not `serde_core`. |
| 9 | //! |
| 10 | //! [`serde`]: https://crates.io/crates/serde |
| 11 | //! |
| 12 | //! In crates that handwrite implementations of Serde traits, or only use them |
| 13 | //! as trait bounds, depending on `serde_core` is permitted. But `serde` |
| 14 | //! re-exports all of these traits and can be used for this use case too. If in |
| 15 | //! doubt, disregard `serde_core` and always use `serde`. |
| 16 | //! |
| 17 | //! Crates that depend on `serde_core` instead of `serde` are able to compile in |
| 18 | //! parallel with `serde_derive` even when `serde`'s "derive" feature is turned on, |
| 19 | //! as shown in the following build timings. |
| 20 | //! |
| 21 | //! <br> |
| 22 | //! |
| 23 | //! <table> |
| 24 | //! <tr><td align="center">When <code>serde_json</code> depends on <code>serde</code></td></tr> |
| 25 | //! <tr><td><img src="https://github.com/user-attachments/assets/78dc179c-6ab1-4059-928c-1474b0d9d0bb"></td></tr> |
| 26 | //! </table> |
| 27 | //! |
| 28 | //! <br> |
| 29 | //! |
| 30 | //! <table> |
| 31 | //! <tr><td align="center">When <code>serde_json</code> depends on <code>serde_core</code></td></tr> |
| 32 | //! <tr><td><img src="https://github.com/user-attachments/assets/6b6cff5e-3e45-4ac7-9db1-d99ee8b9f5f7"></td></tr> |
| 33 | //! </table> |
| 34 | |
| 35 | //////////////////////////////////////////////////////////////////////////////// |
| 36 | |
| 37 | // Serde types in rustdoc of other crates get linked to here. |
| 38 | #![doc(html_root_url = "https://docs.rs/serde_core/1.0.229")] |
| 39 | // Support using Serde without the standard library! |
| 40 | #![cfg_attr(not(feature = "std"), no_std)] |
| 41 | // Show which crate feature enables conditionally compiled APIs in documentation. |
| 42 | #![cfg_attr(docsrs, feature(doc_cfg, rustdoc_internals))] |
| 43 | #![cfg_attr(docsrs, allow(internal_features))] |
| 44 | // Unstable functionality only if the user asks for it. For tracking and |
| 45 | // discussion of these features please refer to this issue: |
| 46 | // |
| 47 | // https://github.com/serde-rs/serde/issues/812 |
| 48 | #![cfg_attr(feature = "unstable", feature(never_type))] |
| 49 | #![allow(unknown_lints, bare_trait_objects, deprecated)] |
| 50 | // Ignored clippy and clippy_pedantic lints |
| 51 | #![allow( |
| 52 | // clippy bug: https://github.com/rust-lang/rust-clippy/issues/5704 |
| 53 | clippy::unnested_or_patterns, |
| 54 | // clippy bug: https://github.com/rust-lang/rust-clippy/issues/7768 |
| 55 | clippy::semicolon_if_nothing_returned, |
| 56 | // not available in our oldest supported compiler |
| 57 | clippy::empty_enums, |
| 58 | clippy::type_repetition_in_bounds, // https://github.com/rust-lang/rust-clippy/issues/8772 |
| 59 | // integer and float ser/de requires these sorts of casts |
| 60 | clippy::cast_possible_truncation, |
| 61 | clippy::cast_possible_wrap, |
| 62 | clippy::cast_precision_loss, |
| 63 | clippy::cast_sign_loss, |
| 64 | // things are often more readable this way |
| 65 | clippy::cast_lossless, |
| 66 | clippy::module_name_repetitions, |
| 67 | clippy::single_match_else, |
| 68 | clippy::type_complexity, |
| 69 | clippy::use_self, |
| 70 | clippy::zero_prefixed_literal, |
| 71 | // correctly used |
| 72 | clippy::derive_partial_eq_without_eq, |
| 73 | clippy::enum_glob_use, |
| 74 | clippy::explicit_auto_deref, |
| 75 | clippy::incompatible_msrv, |
| 76 | clippy::let_underscore_untyped, |
| 77 | clippy::map_err_ignore, |
| 78 | clippy::new_without_default, |
| 79 | clippy::result_unit_err, |
| 80 | clippy::wildcard_imports, |
| 81 | // not practical |
| 82 | clippy::needless_pass_by_value, |
| 83 | clippy::similar_names, |
| 84 | clippy::too_many_lines, |
| 85 | // preference |
| 86 | clippy::doc_markdown, |
| 87 | clippy::elidable_lifetime_names, |
| 88 | clippy::needless_lifetimes, |
| 89 | clippy::unseparated_literal_suffix, |
| 90 | // false positive |
| 91 | clippy::needless_doctest_main, |
| 92 | // noisy |
| 93 | clippy::missing_errors_doc, |
| 94 | clippy::must_use_candidate, |
| 95 | )] |
| 96 | // Restrictions |
| 97 | #![deny(clippy::question_mark_used)] |
| 98 | // Rustc lints. |
| 99 | #![deny(missing_docs, unused_imports)] |
| 100 | |
| 101 | //////////////////////////////////////////////////////////////////////////////// |
| 102 | |
| 103 | #[cfg(feature = "alloc")] |
| 104 | extern crate alloc; |
| 105 | |
| 106 | #[macro_use] |
| 107 | mod crate_root; |
| 108 | #[macro_use] |
| 109 | mod macros; |
| 110 | |
| 111 | crate_root!(); |
| 112 | |
| 113 | #[macro_export] |
| 114 | #[doc(hidden)] |
| 115 | macro_rules! __require_serde_not_serde_core { |
| 116 | () => { |
| 117 | ::core::compile_error!( |
| 118 | "Serde derive requires a dependency on the serde crate, not serde_core" |
| 119 | ); |
| 120 | }; |
| 121 | } |