! / 0 0 0 0 8 ` // 68 ` memoffset-e5f6e18c40ac568a.memoffset.223da16ea5916411-cgu.0.rcgu.o/ lib.rmeta/ 0 0 0 644 31608 ` ELF>y@@GNUrustx9#rustc 1.72.0 (5680fa18f 2023-08-23)ՆQ4-46a989d0e2cef827e$ɛDp>-b114db70ea0690b1rustc_std_workspace_core ūu sR-13da980d6c74fec5U doc_comment  _memoffset__addr_of      raw_ref_macros     _memoffset__field_check  allow_clippy   _memoffset__field_check_tuple    _memoffset__field_check_union"""""" " " ""_memoffset__let_base_ptr   _memoffset_offset_from_unsafeunstable_const   stable_const  -2:tests//// ///  .... ... __privsize_of_pointee raw_field       raw_field_tuple raw_field_unionoffset_of_tupleoffset_of_unionspan_of_memoffset__compile_error   V _ptrV       (  . 7   $ ,  H A crate used for calculating offsets of struct members and their spans.K m This functionality currently can not be used in compile time code such as `const` or `const fn` definitions. p  ## Examples  ``` % use memoffset::{offset_of, span_of}; (  #[repr(C, packed)] * struct HelpMeIAmTrappedInAStructFactory { -$ help_me_before_they_: [u8; 15], ' a: u32  }   fn main() { E assert_eq!(offset_of!(HelpMeIAmTrappedInAStructFactory, a), 15); HG assert_eq!(span_of!(HelpMeIAmTrappedInAStructFactory, a), 15..19); J^ assert_eq!(span_of!(HelpMeIAmTrappedInAStructFactory, help_me_before_they_ .. a), 0..15); a   J This functionality can be useful, for example, for checksum calculations: M ```ignore  struct Message { header: MessageHeader, fragment_index: u32, fragment_count: u32, payload: [u8; 1024], checksum: u16@ let checksum_range = &raw[span_of!(Message, header..checksum)];C& let checksum = crc16(checksum_range);)        (  . 7   $ ,  4 Hidden module for things the macros need to access.7  mem    2[ Use type inference to obtain the size of the pointee (without actually using the pointer).^     )   > `addr_of!`, or just ref-then-cast when that is not available.A  +       ,   -                                 addr_of        $! Deref-coercion protection macro. $ G Prevents complilation if the specified field name is not a part of the J struct definition.  ```compile_fail( use memoffset::_memoffset__field_check;+ struct Foo { foo: i32, type BoxedFoo = Box;) _memoffset__field_check!(BoxedFoo, foo);,/    01   "       unneeded_field_pattern  "  *%$< Prevents complilation if the specified type is not a tuple.?&. use memoffset::_memoffset__field_check_tuple;1( _memoffset__field_check_tuple!(i32, 0);+3    45   "        unneeded_wildcard_pattern   "*, Deref-coercion protection macro for unions./H Unfortunately accepts single-field structs as well, which is not ideal,K but ultimately pretty harmless.#&. use memoffset::_memoffset__field_check_union;1 union Foo { variant_a: i32,(5 _memoffset__field_check_union!(BoxedFoo, variant_a);87    89 "  "    "           2 !!! !!! unused_unsafe!  #!!" "" """"" "" """(J Computes a const raw pointer to the given field of the given base pointer&M to the given parent type.&'A The `base` pointer *must not* be dangling, but it *may* point to'D uninitialized memory.'' ' ;(( ('#( (,((( base(( ((( parent(( ((( ((  (((,(, ( )))) >))) )) ) >))) >))+++ +++ :+  #++, + ,,,,, ,,, >, , , ,, >,,, ,,.;,M! to the given parent tuple typle.-$-<-D=-..=.. tuple_ty... . >.. ..#..2./. >.. ... >..  .// //  ///2/2 / //// >/// // / >/// >//111 111 :1  #222 2 22222 222 >2 2 2 22 >222 227;2MC3$3<3D=44 ## Note4 X This macro is the same as `raw_field`, except for a different Deref-coercion check that4[ supports unions.5f Due to macro_rules limitations, this check will accept structs with a single field as well as unions.5iM This is not a stable guarantee, and future versions of this crate might fail6P? on any use of this macro with a struct, without a semver bump.7B7 7 @77 77#78<888 >88 888 >88 888 88  888<8< 8 8888 >888 88 8 >899 >99::: ::: ::  #;;< ; ;;;;; ;;; >; ; ; ;; >;;; ;<   B   %Q Macro to create a local `base_ptr` raw pointer of the given type, avoiding UB asT much as is possible currently. "  D       E   F                   "       "   uninit             MaybeUninit     "    W                "   W        *4 Macro to compute the distance between two pointers.7H      5  IJ     >      > > #       offset_from  >        Q Calculates the offset of the specified field from the start of the named struct.T use memoffset::offset_of;' a: u32, b: u64, c: [u8; 5]' assert_eq!(offset_of!(Foo, a), 0);*' assert_eq!(offset_of!(Foo, b), 4);* ## Notes B Rust's ABI is unstable, and [type layout can be changed with eachED compilation](https://doc.rust-lang.org/reference/type-layout.html).GT Using `offset_of!` with a `repr(Rust)` struct will return the correct offset of theWO specified `field` for a particular compilation, but the exact value may changeRS based on the compiler version, concrete struct type, time of day, or rustc's mood.VW As a result, the value should not be retained and used between different compilations.Z  L # "  >    !!      base_ptr    >     field_ptr     !!! k!!! >!!! !! ! !!! k! ! k!!$J Calculates the offset of the specified field from the start of the tuple."M""" use memoffset::offset_of_tuple;"###Y assert!(offset_of_tuple!((u8, u32), 1) >= 0, "Tuples do not have a defined layout");#\$$$$N$$ D$$$ $ O$$ $$#$$'$$ $ >$$  $$$ $$  $%%'%' % %%& k%%& >&& & k& &  & &&& k&&& >&&& && ' ''' k' ' k'',Q Calculates the offset of the specified union member from the start of the union.'T((( use memoffset::offset_of_union;(#((5) foo32: i32,) foo64: i64,))))0 assert!(offset_of_union!(Foo, foo64) == 0);)3***J* f Due to macro_rules limitations, this macro will accept structs with a single field as well as unions.*iL+PM+B, , Q,, ,,#,,/,- , >,, ,,, ,,  ,--/-/ - --. k-.. >.. . k. .  . ... k... >... .. / /// k/ / k//   S  &' Reexport for `local_inner_macros`; see*o . r  U       V           inner                   Ԁ   V Produces a range instance representing the sub-slice containing the specified member. Y : This macro provides 2 forms of differing functionalities. = I The first form is identical to the appearance of the `offset_of!` macro. L   span_of!(Struct, member)   b The second form of `span_of!` returns a sub-slice which starts at one field, and ends at another. e% The general pattern of this form is:(  // Exclusive' span_of!(Struct, member_a .. member_b)* // Inclusive( span_of!(Struct, member_a ..= member_b)+ // Open-ended ranges span_of!(Struct, .. end) span_of!(Struct, start ..) ### Note \ This macro uses recursion in order to resolve the range expressions, so there is a limit to_" the complexity of the expression.%N In order to raise the limit, the compiler's recursion limit should be lifted.Q ### Safety[ The inter-field form mentioned above assumes that the first field is positioned before the^ second. / This is only guarenteed for `repr(C)` structs.2Z Usage with `repr(Rust)` structs may yield unexpected results, like downward-going ranges,]e spans that include unexpected fields, empty spans, or spans that include *unexpected* padding bytes.h use memoffset::span_of; #[repr(C)] struct Florp {̎ struct Blarg { x: [u32; 2], y: [u8; 56], z: Florp, egg: [[u8; 4]; 4]- assert_eq!(0..84, span_of!(Blarg, ..));0/ assert_eq!(0..8, span_of!(Blarg, .. y));20 assert_eq!(0..64, span_of!(Blarg, ..= y));3, assert_eq!(0..8, span_of!(Blarg, x));// assert_eq!(8..84, span_of!(Blarg, y ..));21 assert_eq!(0..8, span_of!(Blarg, x .. y));42 assert_eq!(0..64, span_of!(Blarg, x ..= y));5  X #.4  helper root    Expected a range, found '..='       Expected a range, found '..'     >                     >            >                     >                        >           !            >    !!! begin!!  !!!!! !!  !!!"!" ! !!  !  !!!! !!! >!!! !! ! !!  !  !!"! !!" >""" """" " "  "" " "  " "" ""  ""  """ """# " "" "" ""# >## #### ##  ##### ##  ###$#$#$  #  #### ### >### # #  ##  #  ##$# ##$ >$$$ $ $  $$$$ $ $$ $$ $$$ >$$ $$$$ $$  $$$$$%&%&%%  %  %%%% %%% >%%% % %  %%% % %  % %% %%  %%  %%%% %&&& & && && &&& >&& &&&& &&  &&&&&&'&'  & &&'QFound inclusive range to the end of a struct. Did you mean '..' instead of '..='?&S''( ' '' '' '(( >(( (((( ((  ((((()() ( ((  (  (((( ((( >((( ((() ( (  (( ( (  ) )) ))  ))  ))) )))* ) )) )) ))) >)) ))))))) ))  ) ****  **  ***** rest**  * ******  * *** * ** *** >******* * ***  ******* ҿ* ***+ * ** *+ +++ >++ +++++  ++  +++++ ҿ++  + ++++++  + +++ + ++ +++ >++++  +++++++ ҿ+ ++,,,  ,, ,,,,,, exp,,  , ,,,.,. , ,,, ,,,  ,, - >-- - -  -- --- -- --  - --- - - ---  -------- - -- - - >-- - - >..4https://doc.rust-lang.org/reference/type-layout.htmldn=". K dn="v%` dn="4NHFkdn="ʭildn="Xߨdn=".LZQtdn="Qutϊdn="EaDdn="?u_dn="\ַcdn="6m"idn="yQDdn="z\vxdn="%[:[dn="zm]9W>sdn="zS0mVdn="L L0dn="?j :dn="."ldn="\0X.dn="5LPadn="lu%dn="t11wdn="}sdn=")wdn="X ? } DB% !% )*]-06 :>?@@ C*? %%%%%%%%%%%%%% B?3"O'*6+|.48<>@TJ;my!%)*W-06:>?@<s+-~"I' *0+v.48<> @NJ^Jr@A1'(y :*>{~ !(/6=Siw4"P'7+}.48<@UJPfdn="jKb⠧nnnnnnnODHT  dn="Xߨdn="X ? }dn="EaDdn="."ldn="z\vx dn=".LZQtdn=")wdn="ʭildn="L L0dn="4NHFkdn="lu%dn="6m"i dn="zS0mVdn="\0X.dn="}sdn="Qutϊdn="\ַc dn="?j :dn="v%` dn="zm]9W>sdn="%[:[ dn="5LPadn="t11wdn="?u_dn=". K dn="yQD >"_B:|6b4uj|E|9E0@/">"_B:|6b4u]/home/steffen/.cargo/registry/src/index.crates.io-6f17d22bba15001f/memoffset-0.8.0/src/lib.rs PG>e@EſK]#PQPMI<R3NLOJQQ Lq).(IKbND* 8#F 8c9   H@2Taװc/home/steffen/.cargo/registry/src/index.crates.io-6f17d22bba15001f/memoffset-0.8.0/src/raw_field.rs ?_U?"OzS.PQPMI<R3NLOJQQ B#-#[C%K,-'!IK1%'!IK%%@2,-24-20L$29-!IK4X % -!IKX % NE$03G"R,QE N%E$.9G"R,QE N%E \jQC$09G"R,QE sOTʆŬK[c/home/steffen/.cargo/registry/src/index.crates.io-6f17d22bba15001f/memoffset-0.8.0/src/offset_of.rs g[*ڀgvS¦S#PQPMI<R3NLOJQQ U#(!@EDB%J3(!KPN86-$JGPdP;-#-U++ FHXSW[$$N6?<N$]$"N6E<U$4 jQC$$N6E<  +++ C  +++ ++ U 111  0 !!/& ( %$'.0    $LLL $$%0J 0J 0J   $RRR:  6' )& 6: & -tmeg:ææ#PQPMI<R3NLOJQQ +s)&Z>Mf)+, `&R_ 3^i1340356$(D&C$5B>4N=D)J84NI64"A6BB$a>8RVHF<#/"F   ,,0 C ,,0   $.0G23   /0/10123C!8 !8 !8 #: "5 #R   d5 ?pqrrt|vx86_64-unknown-linux-gnu_}3g9N memoffset-e5f6e18c40ac568adn=" ((hhhhhh$$$$ @ @ $ $ @@``hhhhHH ] .note.gnu.property.shstrtab.strtab.symtab.rmeta@ .`Gy&yyy5/0 0 0 0 644 584 ` ELF>@@6.text.debug_aranges.note.GNU-stack.strtab.symtabmemoffset.223da16ea5916411-cgu.0&pW@@@.@0