rustG#rustc 1.71.0 (8ede3aae2 2023-07-12)p,xB7L-4c3ff48df34f5f95z-=1VYc-c7cd577a60a88eb7rustc_std_workspace_corefΝf,ޚsu-ba6f8b8bb8f76d1dV array_ref array_refsmut_array_refs array_mut_refyB This package contains just four macros, which enable the creationE? of array references to portions of arrays or slices (or thingsFB that can be sliced). # ExamplesB Here is a simple example of slicing and dicing a slice into arrayE: references with these macros. Here we implement a simple=C little-endian conversion from bytes to `u16`, and demonstrate codeFC that uses `array_ref!` to extract an array reference from a largerF? array. Note that the documentation for each macro also has anB example of its use. ``` #[macro_use] extern crate arrayref;& fn read_u16(bytes: &[u8; 2]) -> u16 {)0 bytes[0] as u16 + ((bytes[1] as u16) << 8)3 } // ...  # fn main() {" let data = [0,1,2,3,4,0,6,7,8,9];%1 assert_eq!(256, read_u16(array_ref![data,0,2]));4/ assert_eq!(4, read_u16(array_ref![data,4,2]));2 # }  C You can use `array_ref` to generate an array reference to a subsetFA of a sliceable bit of data (which could be an array, or a slice,D or a Vec).* **Panics** if the slice is out of bounds.-      ) 3    % 4 2      B You can use `array_refs` to generate a series of array referencesEB to an input array reference. The idea is if you want to break anE> array into a series of contiguous and non-overlapping arrays.AA `array_refs` is a bit funny in that it insists on slicing up theDA *entire* array. This is intentional, as I find it handy to makeD? me ensure that my sub-arrays add up to the entire array. ThisB= macro will *never* panic, since the sizes are all checked at@ compile time.@ Note that unlike `array_ref!`, `array_refs` *requires* that theCC first argument be an array reference. The following arguments areFA the lengths of each subarray you wish a reference to. The totalD> of these arguments *must* equal the size of the array itself.A)3    let data = [0,1,2,3,4,0,6,7];!( let (a,b,c) = array_refs![&data,2,2,4];+ assert_eq!(read_u16(a), 256);!" assert_eq!(read_u16(b), 3*256+2);% assert_eq!(*c, [4,0,6,7]);    3C You can use `mut_array_refs` to generate a series of mutable array&F@ references to an input mutable array reference. The idea is if'C; you want to break an array into a series of contiguous and(>? non-overlapping mutable array references. Like `array_refs!`,(BB `mut_array_refs!` is a bit funny in that it insists on slicing up)E@ the *entire* array. This is intentional, as I find it handy to)C> make me ensure that my sub-arrays add up to the entire array.*AB This macro will *never* panic, since the sizes are all checked at*E++? Note that unlike `array_mut_ref!`, `mut_array_refs` *requires*+B; that the first argument be a mutable array reference. The+>@ following arguments are the lengths of each subarray you wish a,CB reference to. The total of these arguments *must* equal the size,EC of the array itself. Also note that this macro allows you to take-FB out multiple mutable references to a single object, which is both.E weird and powerful....../. fn write_u16(bytes: &mut [u8; 2], num: u16) {/1 bytes[0] = num as u8;/" bytes[1] = (num >> 8) as u8;/%0. fn write_u32(bytes: &mut [u8; 4], num: u32) {01"0D bytes[1] = (num >> 8) as u8; // this is buggy to save space...0G1 1  1" let mut data = [0,1,2,3,4,0,6,7];1%0 let (a,b,c) = mut_array_refs![&mut data,2,2,4];13, // let's write out some nice prime numbers!2/ write_u16(a, 37);2 write_u16(b, 73);2J write_u32(c, 137); // approximate inverse of the fine structure constant!3M 333 3 34HB You can use `array_mut_ref` to generate a mutable array referenceBEA to a subset of a sliceable bit of data (which could be an array,BD or a slice, or a Vec).CC C-DDDDD"D1"D"E%E E  E& let mut data = [0,1,2,3,4,0,6,7,8,9];E)( write_u16(array_mut_ref![data,0,2], 1);F+( write_u16(array_mut_ref![data,2,2], 5);F+. assert_eq!(*array_ref![data,0,4], [1,0,5,0]);F1) *array_mut_ref![data,4,5] = [4,3,2,1,0];G,) assert_eq!(data, [1,0,5,0,4,3,2,1,0,9]);G, GGH H HH   4H      arr                            #    as_array                                                                 .      unused_unsafe # 0  & .  pre   post  !!! $      unused_assignments   eval_order_dependence #   as_arrays   a      7      8  #  min_len 7   8     var_len <   ?   <  ?   p <    aref   B     7 B B  7 C   sl   from_raw_parts B     @ B B  @ F    C   B     8 B   B        8   C       input    .  !!! !!! 5! #!!! ;! !! K!!!" ! ."" """""" "" "" """&"&"&""" """" """ :"""# ""# ## ;# ##  # ;# # #### <## ### ###### # # # ####### ### ### ## ##% $ $ B$$ <$$ $$$$$%$$%$% $ C$$ $ $$$ B$ $ $ $$$ $$$ $$ B%% B%% %%%% % % %% C%% % % K%%% .%%&&& &&& 5& #&&& ;& && K&4B444 .44 444444 744 44 44444444 844 44 444=4=4= $4 44  45555 5555 555 :5555 555 55 ;5 #6  6 ;6 6 6666 <66 6 666 6666 666 6 666 666 766 6 6 666 66666 6 666 666 866 66<# 6 ?677777 77 7 77777 87 7 7 77 7 @77 <77 777 7 ?77 7 777 <77 7777 ?77 8 8 B88 <88 as_mut_ptr8 8888<88989 8 C88 8 8 888 B8 8 8 888 888 788 B99 B99 9999 799 C99 99: 9 F99  99 from_raw_parts_mut9:: B: : : : :: @:: B:: B:: ::: @:: F::::<:< ; C;; ; ; ;;; B; ; ; ;;; ;;; 8;; B;; B;; ;;;; 8;; C;< < < K<<< .<<<<< <<< 5< #<<= ;= == K==== = .== ====== == == ===B=B=B=== =>>> >>> :>>>> >>> >> ;> #>  > ;> > >>>? <>> ? ??? ?????? ? ? ? ??????? ? ??? ??? ?? ??A ? ? B?? <?? e? ????A??A?A @ C@@ @ @ @@@ B@ @ @ @@@ @@@ @@ B@@ B@@ @@@@ @@ C@A A A KAAA .AAAAA AAA 5A #AAB ;B BB KBBHKHHH .HH HHH HH HHH HH HHHKHKHK!HHH H #I  I 0II IIII  II I III II I III III IIJ I I IIJ  II eI II I I IIJ III I J JJJ JJ J  JJ J JJ .JJJ JJ J JJ JJJJK JKK 5K #KKK 0KKK  K0rBxx^3f jw0rBx5 0rBx)H0rBx6,Fk0rBxCHVX0rBx!u g0rBx)™&0rBxlj2o'z{ )%%%%st !tu mn  <],=0rBxjKbXC`ChCpCCCCODHT 0rBx)™&0rBx!u g0rBx)H0rBxlj2o0rBxCHVX0rBx5 0rBxx^3f jw0rBx6,Fk}3g7,h;5}3g7,h;5h/Users/richardalbertleddy/.cargo/registry/src/index.crates.io-6f17d22bba15001f/arrayref-0.3.7/src/lib.rs !-'=*wyFCF>GGC*4 &53  GE.*4 &53/ ?7"7$  FFBEECADGEB*4 ","&D )4`<1-(;%L(<&$! * )4X(:1$! GD?CFDBFC?DFGF2&2H &40ND )4p<1-,<%N(=&$! * )4`,<%$! FE.2& *,,2--/ G=":$   <&J4> @)- &.C%6 /:O'C&6 4) OG%6 3:O,G'6 4. O+=%&%'&+,,. +<%&%'&+,,.+5I)*)+*0315*+5H)*)+*0315(*)4'/-5-5)1P5;K 65I