Files
boc/aamos-ledger-rust/target/debug/deps/libstatic_assertions-8079cf0525352562.rlib
T

190 lines
53 KiB
Plaintext
Raw Normal View History

!<arch>
/ 0 0 0 0 8 `
// 84 `
static_assertions-8079cf0525352562.static_assertions.13e7e957b65c79a1-cgu.0.rcgu.o/
lib.rmeta/ 0 0 0 644 52992 `
ELF·€Í@@GNUÀrust
#rustc 1.96.0 (ac68faa20 2026-05-25)ÁíàÄTËŸ ÜJîÄ)'ß\¥!-3d1337db07d0b3aeÁ¤°ð ¾ä-±($²ï=©Ã-7e98a21bfd32b0edÁí_coreÁ
assert_cfgÁ¦assert_eq_alignÁ¾assert_eq_sizeÁÛassert_eq_size_ptrÁassert_eq_size_valÁ
assert_fieldsÁ © assert_implÁassert_impl_oneÁassert_impl_allÁassert_impl_anyÁassert_not_impl_allÁassert_not_impl_anyÁassert_obj_safeÁÌ assert_traitÁassert_trait_sub_allÁassert_trait_super_allÁ assert_typeÁassert_type_eq_allÁassert_type_ne_allÁ const_assertÁøconst_assert_eqÁconst_assert_neÁ 횦 ¾Ût  ÷
”ˆ ©l

Ö ì|â'˜œºH²œ´\Ìü¤É
´¢Æ”‚ ß”¸ø  ¨ üùüŽ [![Banner](https://raw.githubusercontent.com/nvzqz/static-assertions-rs/assets/Banner.png)](https://github.com/nvzqz/static-assertions-rs)ÁúÄ“ <div align="center">Áü¬=: <a href="https://crates.io/crates/static_assertions">Áüê]Z <img src="https://img.shields.io/crates/d/static_assertions.svg" alt="Downloads">Á </a>ÁüÕC@ <a href="https://travis-ci.org/nvzqz/static-assertions-rs">Áü™mj <img src="https://travis-ci.org/nvzqz/static-assertions-rs.svg?branch=master" alt="Build Status">Ád‡ƒ ü”[X <img src="https://img.shields.io/badge/rustc-^1.37.0-blue.svg" alt="rustc ^1.37.0">Á„ð
<br><br>ÁT </div>ÁŒúüNK Assertions to ensure correct assumptions about constants, types, and more.ÁßúüãMJ _All_ checks provided by this crate are performed at [compile-time]. ThisÁü±IF allows for finding errors quickly and early when it comes to ensuringÁüûJG certain features or aspects of a codebase. These macros are especiallyÁüÆPM important when exposing a public API that requires types to be the same sizeÁü—  or implement certain traits.Á¸ú # UsageÁÈúüÌOL This crate is available [on crates.io][crate] and can be used by adding theÁüœ /, following to your project's [`Cargo.toml`]:ÁÌ ú ```tomlÁ”Ü  [dependencies]Áüï  static_assertions = "1.1.0"Á<
 ```Á
úü›
85 and this to your crate root (`main.rs` or `lib.rs`):ÁÔ
ú
„à
#[macro_use]Áüñ
# extern crate static_assertions;Á”•  # fn main() {}Á ° úü´ MJ When using [Rust 2018 edition][2018], the following shorthand can help ifÁü‚ )& having `#[macro_use]` is undesirable.Á¬ ú”°  ```edition2018Áüà )& extern crate static_assertions as sa;Áí úäñ  sa::const_assert!(true);Á

ú
# ExamplesÁ©
úü­
74 Very thorough examples are provided in the docs forÁüå
PM [each individual macro](#macros). Failure case examples are also documented.Áú
# ChangesÁÈúüÌ`] See [`CHANGELOG.md`](https://github.com/nvzqz/static-assertions-rs/blob/master/CHANGELOG.md)Áü­KH for an exhaustive list of what has changed from one version to another.Áùú # DonateÁŠúüŽNK This project is made freely available (as in free beer), but unfortunatelyÁüÝNK not all beer is free! So, if you would like to buy me a beer (or coffee orÁü¬KH *more*), then consider supporting my work that's benefited your projectÁäø and thousands of others.Áúü™,) <a href="https://www.patreon.com/nvzqz">ÁüÆvs <img src="https://c5.patreon.com/external/logo/become_a_patron_button.png" alt="Become a Patron!" height="35">Á </a>ÁüÆ*' <a href="https://www.paypal.me/nvzqz">Áüñnk <img src="https://buymecoffee.intm.org/img/button-paypal-white.png" alt="Buy me a coffee" height="35">ÁíéúüíGD [Rust 1.37]: https://blog.rust-lang.org/2019/08/15/Rust-1.37.0.htmlÁüµXU [2018]: https://blog.rust-lang.org/2018/12/06/Rust-1.31-and-rust-2018.html#rust-2018ÁüŽ74 [crate]: https://crates.io/crates/static_assertionsÁüÆ>; [compile-time]: https://en.wikipedia.org/wiki/Compile_timeÁü…KH [`Cargo.toml`]: https://doc.rust-lang.org/cargo/reference/manifest.htmlÁLhttps://raw.githubusercontent.com/nvzqz/static-assertions-rs/assets/Icon.pngÁlœ'https://docs.rs/static_assertions/1.1.0ÁlÙ íÆšÖ¦æ¾õÛ ÷
" ©1
Ö@ìO^˜m²|Ìü𩯏ßÇøÖå¨ôÆô²Ö¼¥ ü.+ Asserts that a given configuration is set.Á/út3©BúüFPM A project will simply fail to compile if the given configuration is not set.Áú<ü£?< # #[macro_use] extern crate static_assertions; fn main() {}ÁÜã // We're not masochistsÁüÿ>; # #[cfg(not(target_pointer_width = "16"))] // Just in caseÁü¾2/ assert_cfg!(not(target_pointer_width = "16"));ÁùúüýJG If a project does not support a set of configurations, you may want toÁüÈPM report why. There is the option of providing a compile error message string:Áú<ü¥?‰*üå  # #[cfg(any(unix, windows))]Áü†QN assert_cfg!(any(unix, windows), "There is only support for Unix or Windows");ÁØúüÜ0- // User needs to specify a database back-endÁü63 # #[cfg(target_pointer_width = "0")] // ImpossibleÁüÄEB assert_cfg!(all(not(all(feature = "mysql", feature = "mongodb")),ÁüŠEB any( feature = "mysql", feature = "mongodb")),ÁüÐNK "Must exclusively use MySQL or MongoDB as database back-end");Á§úü«NK Some configurations are impossible. For example, we can't be compiling forÁüú,) both macOS _and_ Windows simultaneously:Á§ úœ«  ```compile_failÁü¿ ?‰*üÿ (% assert_cfg!(all(target_os = "macos",Áü¨
+( target_os = "windows"),ÁüÔ
85 "No, that's not how it works! ಠ_ಠ");Á< (|• æ ½  Ä
  Ã  Ä *Æ  É  Ê % Ë  Ñ  ð  , Ò  Ó  Ý , Ô 8âÕ & Ø 8û  Þ $ ß , á 8msgÁâ & å 8 , ë  ì  î $ í - ï *ò  õ  · + ÿ   8â   8
  ˆ  ,  Š  , 8⌠ 8¢l  ª  «  ° , ¬ 8…6­ % ± % ¸  ¾  Ê , ¿  À  È , Á 8â & Å 8¯Æ 
É *Ì  Ï  Á
+ Ù  Ú  í 8âÛ  Þ  ì 8
ß  â  ë , ã  ä  é , å 8âæ 
ê 8¢ 

 º
8¨4†
 Œ

 ¹
7Cfg does not pass: Á¬Ž
$ £
8Ô
 ®
 ¯
 ¸
, °
 ±

, ²
8â³

·
% »
% Â
œãä¤ü.+ Asserts that types are equal in alignment.Á/úü3NK This is useful when ensuring that pointer arithmetic is done correctly, orÁü‚OL when [FFI] requires a type to have the same alignment as some foreign type.ÁÒú©åúüé96 A `usize` has the same alignment as any pointer type:Á£úü¯?‰*üï0- assert_eq_align!(usize, *const u8, *mut u8);Á< ¨úü¬LI The following passes because `[i32; 4]` has the same alignment as `i32`:Áùúü…?‰*üÅ$! assert_eq_align!([i32; 4], i32);ÁòúüöKH The following example fails to compile because `i32x4` explicitly has 4ÁüÂ&# times the alignment as `[i32; 4]`:Áéúœí—3ü?‰*üÁ$! # #[allow(non_camel_case_types)]Á´æ #[repr(align(16))]ÁÜý struct i32x4([i32; 4]);Áúü&# assert_eq_align!(i32x4, [i32; 4]);ÁÌúüÐC@ [FFI]: https://en.wikipedia.org/wiki/Foreign_function_interfaceÁ(|”õ Á û
 Ç à , È8Ã É& Ê8´Ë$ Í, Ï Ð ×, Ñ8xsÁÒ& Ô8´Õ$ Ø Ù, Û Ü Þ$ Ý- ß*â å ø
 88 õ& ö8 ø ú û ýÿ  ñ

8#þ ,
8
'ˆ
8š
'
8í
'
8 D
% ž
, ¬
 ­
 æ
8®
8 ²
& ³
 µ
 Ê
 
 ·
% ¸
8 
'Â
 Ä
, Å
8Ã Æ
 Ç
 È
 É
 Ì
 Î
 ä
  Ï
 Ð
% Ñ
8 
'Û
 Ý
, Þ
8ßDß
 á
 â
 ã
% å
 ç
% ò
% ù
”øÜ ü)& Asserts that types are equal in size.Á*úü.NK When performing operations such as pointer casts or dealing with [`usize`]Áü}OL versus [`u64`] versus [`u32`], the size of your types matter. That is whereÁüÍ this macro comes into play.Áíú”ñ # AlternativesÁúüˆOL There also exists [`assert_eq_size_val`](macro.assert_eq_size_val.html) andÁüØPM [`assert_eq_size_ptr`](macro.assert_eq_size_ptr.html). Instead of specifyingÁü©PM types to compare, values' sizes can be directly compared against each other.Áúú©úü‘LI These three types, despite being very different, all have the same size:ÁÞúüê?‰*üª.+ assert_eq_size!([u8; 4], (u16, u16), u32);ÁáúüåPM The following example fails to compile because `u32` has 4 times the size ofÁ `u8`:ÁÀúœÄ—3üØ?‰*ì˜ assert_eq_size!(u32, u8);Á¾úüÂA> [`usize`]: https://doc.rust-lang.org/std/primitive.usize.htmlÁü„=: [`u64`]: https://doc.rust-lang.org/std/primitive.u64.htmlÁüÂ=: [`u32`]: https://doc.rust-lang.org/std/primitive.u32.htmlÁ(|€  ¬  Ã
 ²  Ë  , ³ 8Ã ´ & µ 8´$ ¸ , º  »  Â , ¼ 8ßD½ & ¿ 8´À $ Ã  Ä , Æ  Ç  É $ È - Ê *Í  Ð  À
 88 à & á 8 ã  å  æ  è ê  í  ¹
, û  ü  ®
8ý 8
 ƒ
,
8,†
'
8š,
'
8í
'
8L™
'¢
 ¤
, ¥
8Ã ¦
$ §
, ©
8ßDª
 ¬
% ­
 ¯
% º
% Á
üƒüÆ
52 Asserts that values pointed to are equal in size.Áü
út€ © úü“ PM This especially is useful for when coercing pointers between different typesÁüä 96 and ensuring the underlying values are the same size.Áž ú üª ?‰*üê 0- fn operation(x: &(u32, u32), y: &[u16; 4]) {Áü›
" assert_eq_size_ptr!(x, y);Á
 // ...Á

Û
úüß
KH The following example fails to compile because byte arrays of differentÁü«! lengths have different sizes:ÁÍúœÑ—3üå2/ # #[macro_use] extern crate static_assertions;ÁŒ˜ # fn main() {Áüª static BYTES: &[u8; 4] = &[ÁŒÊ /* ... */Á # 0; 4Á ];Áòúüö  static TABLE: &[u8; 16] = &[ÁŒ—È\ # 0; 16Áù\ÀúüÄ&# assert_eq_size_ptr!(BYTES, TABLE);Á(|ó £  © Æ , ª8à «& ¬8$­$ ±, ³ ´ ½, µ8ßD& ¸8$ ¾ ¿, Á  Ä$ Ã- Å*È Ë  + Õ Ö ˜8« Ü 8
unknown_lintsÁ$ ê8 unsafe_codeÁ$ ÷8 forget_copyÁ$ 8useless_transmuteÁŒ†8¢8 ¦ ¨ª8"4­ ´ ù8#Â, Æ8'Ì8š'Ó Õ Þ8íÖ$ Ù8µ Û% ß8í8ñ8æ ú8µ ü'ÿ8readÁ$  ˆ, 8à % ,  ˜ Ï8µ 'œ8writeÁ £ Í ¤8¥8æ$ ­8í¯'²8L´ ½ Ì8µ ¾'Á8ïb Ç Ë, È8ßDÉ% Î Ð8íÞ'á8ê é î8æ% ï% úüûü…*' Asserts that values are equal in size.Á°úü´?< This macro doesn't consume its arguments and thus works forÁìô non-[`Clone`]able values.Áút–©¥úü±2Ê[Œä…\¤ö struct Byte(u8);ÁúŒ let x = 10u8;Áü¡63 let y = Byte(42); // Works for non-cloneable typesÁØúôÜ assert_eq_size_val!(x, y);Áüû# assert_eq_size_val!(x, y, 0u8);Á # }Á¯úü³JG Even though both values are 0, they are of types with different sizes:Áþúœ‚—3ü–2Ê[ŒÉ…\üÛ# assert_eq_size_val!(0u8, 0u32);Á<ÿ¨i<‡úü“C@ [`Clone`]: https://doc.rust-lang.org/std/clone/trait.Clone.htmlÁ(ü×#"  ø ¡ ¾ , ¢8à £& ¤8$ ©, « ¬ µ, ­8ßD®& °8$  ·, ¹ º ¼$ »- ½*À à ö8÷”Í ß à ï á, â8à ã$ ä, æ ç ì è, é8ßDê$ í î% ðŒŒlÔ€
ü/, Asserts that the type has the given fields.Á0út4©CúüGMJ One common use case is when types have fields defined multiple times as aÁü•HE result of `#[cfg]`. This can be an issue when exposing a public API.ÁÞúüê2Ê[œ pub struct Ty {Á¼± #[cfg(windows)]Á¬É pub val1: u8,Áäß #[cfg(not(windows))]ÁÄü pub val1: usize,Áú¤™ #[cfg(unix)]Á´® pub val2: u32,ÁÌÅ #[cfg(not(unix))]ÁÄß pub val2: usize,ÁZþúü‚*' // Always have `val2` regardless of OSÁì­ assert_fields!(Ty: val2);ÁÓúü×/, This macro even works with `enum` variants:Áú<‹ü“?‰* enum Data {Á
Val {Á¤ñ id: i32,Á̆ name: String,Áì  bytes: [u8; 128],Á },Á¼É Ptr(*const u8),ÁZçúüë)& assert_fields!(Data::Val: id, bytes);Á<•úü¡b_ The following example fails to compile because [`Range`] does not have a field named `middle`:Áúœˆ—3üœ?‰*ÄÜ use std::ops::Range;Áõúüù'$ assert_fields!(Range<u32>: middle);Á© úü­ B? [`Range`]: https://doc.rust-lang.org/std/ops/struct.Range.htmlÁ(|ð 1
 Ç ¡
 Ã
, ¢
8¿ £
& ¤
8¼
'ª
, ¬
8Á ­
& ®
8¼
& ´
,
 ·
 À
, ¸
8± ¹
& º
8¼
$ Á
 Â
*Å
 È

 + Ò
 Ó
 8«
 Ù
 ÿ
8¤`
$ ç
8unneeded_field_patternÁ´é
8 8 & 8     ˜ š   Ž
+ «  ¬  Ó 8«  ²  Ò 8 $ ¼ 8unreachable_patternsÁ¤¾ 8 á 8Ó  ê  ô 8» & ð , ò 8¿ ó  ö 
8 8»   ö , ª  «  Ç  , ¬ 8¿ ­ '® , ° 8Á ±  ³  ¿ , µ 8± & · 8 ¹ $ º !¼ *Á  Ä  Å $ Æ  È 8 Þ *à  ã  ä %
%
 œ
 ³
 ,
8¿ ž
& Ÿ
8õ