Files
boc/aamos-ledger-rust/target/debug/deps/liballocator_api2-7b02f80e4eb85c1b.rmeta
T

1370 lines
465 KiB
Plaintext
Raw Normal View History

rust
A#rustc 1.96.0 (ac68faa20 2026-05-25)ÁíàÄTËŸ ÜJîÄ)'ß\¥!-3d1337db07d0b3aeÁ¤²XctÔ'ÐÓ©z¨ɽÓ-a4945860e1c53b00Á¤°ð ¾ä-±($²ï=©Ã-7e98a21bfd32b0edÁsystemÁ4»À||SystemÁ4¼»À|”AerrorÁ,¬ð»À|–ðâioÁÅ »À âcautiousÁDÅÌ»serdeÁŒªÌâ InPlaceSeedÁ\ÒλŒ³Îㄆ”…nightlyÁ<络Íí alloc_crateÁ·¤globalÁ            
     
alloc_implÁ grow_implÁ allocateÁallocate_zeroedÁ
deallocateÁgrowÁ grow_zeroedÁshrinkÁ 
  
/× AllocatorÁ1Ñ1à1ö111¤1by_refÁ99Ñ9à9ö999¤boxedÁAAAAAAAAAA A
A A A
AAAAAAAAAAAAAAAAAAA A!A"A#A$A%ABoxÁh
h¥hhˆhAn¥nAq¥qAt¥tæ t
new_uninitÁt
new_zeroedÁtÿ
ttry_newÁttry_new_uninitÁttry_new_zeroedÁA}¥}}new_inÁ}
try_new_inÁ}
new_uninit_inÁ}try_new_uninit_inÁ}
new_zeroed_inÁ}try_new_zeroed_inÁ}pin_inÁ}into_boxed_sliceÁ }
into_innerÁAŠ¥Šnew_uninit_sliceÁŠnew_zeroed_sliceÁŠtry_new_uninit_sliceÁŠtry_new_zeroed_sliceÁA¥new_uninit_slice_inÁnew_zeroed_slice_inÁtry_new_uninit_slice_inÁtry_new_zeroed_slice_inÁinto_vecÁA˜¥˜˜ä˜writeÁA¥äA¡¥¡from_rawÁA ¤¥¤¤ from_raw_inÁ¤into_rawÁ¤into_raw_with_allocatorÁ¤
into_non_nullÁ¤¨¤leakÁ¬'aÁ¤into_pinÁA
¯¥¯¯ãA ³¥³>A ¥>¹ A
»»>½ A¿¥¿¿ƒ¿AăAÆ¥ÆÆÆØ AË¥ËËï
ËÃËˌˢAÓ¥ÓÓA×¥×AÚ¥ÚÚ§ÝAߥßßfinishÁß´
ßwrite_u8Áß write_u16Áß write_u32Áß write_u64Áß
write_u128Áß write_usizeÁßwrite_i8Áß write_i16Áß write_i32Áß write_i64Áß
write_i128Áß write_isizeÁAð¥ð÷Aó¥óó÷A÷¥÷÷÷Aûû÷Aþþ÷A¥Ÿ žˆ
Aˆ¥ˆŸˆ ˆ÷Œ AŽ¥ŽŽŸŽ ŽErrorÁŽª AdowncastÁ˜¥downcast_uncheckedÁš¥Aœœéž¥œ ¥A ¢¢é¤¥¢¦¥A!¨¥¨¨×A"¬¥¬¬×A#°¥°°×A$´¥´´å´´A%¹¥¹¹A&½š½½½ó ½ size_hintÁ½nthÁ½ABoxIterÁÅÅA'ÈšÈÈÈÌsomeÁÍ¥A(ÏšÏÏ next_backÁÏnth_backÁA)ÔšÔÔA*ØšØA+ÛšÛùÝ¥A,ߥß߃ßA-ä¥ääborrowÁA.è¥èè
borrow_mutÁA/ì¥ììÉA0ð¥ððas_mutÁA1ô¥ôA2÷÷÷°÷Š A3üüextendÁþšþ raw_vecÁ 
  
š÷œ÷ž× AllocInitÁ 
UninitializedÁ¡
 ZeroedÁ£
RawVecÁ¥¥¥¥µ ¥capÁ¥¤«¥«®¥®±¥±æ ±
with_capacityÁ±with_capacity_zeroedÁ¥MIN_NON_ZERO_CAPÁÛ with_capacity_inÁwith_capacity_zeroed_inÁinto_boxÁ allocate_inÁfrom_raw_parts_inÁµ capacityÁ¨current_memoryÁreserveÁÄdo_reserve_and_handleÁÅ¥Åreserve_for_pushÁ try_reserveÁ
reserve_exactÁtry_reserve_exactÁ
shrink_to_fitÁÍ¥ÍÍ
needs_to_growÁÍset_ptr_and_capÁÍgrow_amortizedÁÍ
grow_exactÁÍ¤Ô  finish_growÁÖÖ Ö  Ú¥ÚÚãhandle_reserveÁÞ  alloc_guardÁcapacity_overflowÁÁââââââââââ â
â â â
âââââââââââââââââââ â!â"â#â$âspliceÁˆˆˆˆˆˆˆˆˆˆ ˆšó ³ˆšÁˆšˆ š  ãˆ¤¥¤¤fillÁ§š¤ move_tailÁâ%âdrainÁ«««««««««« «
« « «
««DrainÁ»ø»¥»»
tail_startÁ»tail_lenÁ»ù»Á«Ã¥ÃÃ×«ÇøÇ¥ÇÇas_sliceÁÇ¨Ç keep_restÁ«ÎøÎ¥ÎÎɫӥӫ֥֫٥ÙÙÙó Ý Ù³«à¥ààÁã «å¥ååãè DropGuardÁé
é'rÁéøé¥ééˆèðø+ðøð¥ððã«ö¥ö« ù¥ùâ&âêýýýýýýýýýý ý
ý ý ý
ýýýýýIntoIterÁ¥bufÁphantomÁˤµ þý¥×ý¥ù) as_mut_sliceÁ¨as_raw_mut_sliceÁý¤¥¤¤Éý¨¥¨ý«¥«ý®¥®®®ó ®³®üýµ¥µµÁý¹¥¹ý¼¥¼ý ¿¥¿¿ƒý
Ã¥ÃÃãÆâ+Ç
ÇøÇ¥ÇLjÆÍ¥ÍÍãâ
partial_eqÁÑÑÑÑ__impl_slice_eq1Áâset_len_on_dropÁÖ SetLenOnDropÁ×ø×× local_lenÁÖÛøÛæ Û
increment_lenÁÖßãâ'âöâ¥ââ€.ââç¥çæ ççfrom_raw_partsÁâì¥ììÛ ìƒ ìÝ ìinto_raw_partsÁìinto_raw_parts_with_allocÁìþ ì¬!ì“"ì€"ì¨"ìÁ"ì shrink_toÁìÞ
ìtruncateÁìù)ìô.ìas_ptrÁì
as_mut_ptrÁì¨ìset_lenÁì swap_removeÁƒ
assert_failedÁìinsertÁ¢6ìremoveÁ¢6ìretainÁ ì
retain_mutÁŒŒBackshiftOnDropÁŽøŽ¥ŽŽÁŽ
processed_lenÁŽ deleted_cntÁŽ original_lenÁŒ¥ãŒ process_loopÁšš¥ššDELETEDÁŒ Œ ì dedup_by_keyÁ¡¡œ¡ ìdedup_byÁ¥¥
FillGapOnDropÁ§ø§¥§§readÁ§´
§Á¥®ø®¥®®ãìpushÁìpush_within_capacityÁìpopÁìappendÁìappend_elementsÁì(¸£ìclearÁììis_emptyÁì split_offÁ½¢6ì resize_withÁ¿ììÁøìspare_capacity_mutÁìsplit_at_spare_mutÁìsplit_at_spare_mut_with_lenÁâÆ¥ÆÆresizeÁÆextend_from_sliceÁÆextend_from_withinÁË£Ë Ë âÏ¥ÏÏŸÏ Ïinto_flattenedÁâ
ExtendWithÁÕ¥Õó Õâ
ExtendElementÁÙ
٥وâÝ¥Ýó Ýâá¥áá extend_withÁäâæ¥æædedupÁé âë¥ëëåë´âð¥ððâ ô¥ôôƒôâ
ù¥ùù§üâ þ¥þšþþ°þÖâ ¥š×â
¥ùšâ¥à-êâø¥à-êâšøš¥šššà-šêâ¡¥¡¡œ¤šâ¦¥¦¦•&©£©šâ¬ø¬¥¬¬œ°šâ²¥²²ï
â¥â¹¥¹¹â½¥½½ãâÁ¥Á>âÄ¥ÄÄ×âÈ¥ÈÈÉâÌ¥ÌÌÊâÐ¥ÐÐÉâÔ¥ÔÔÊâØ¥Ø÷âÛ¥Û÷â Þ¥ÞŸÞ Þ÷â â!ä¥ää÷â"è¥èèŸè è÷í â#ï¥ïï÷â$ó÷â%õ¥õõŸõ õÃõªû û â from_elem_inÁþ¥þâ from_elemÁ¥macrosÁƒÁžSliceExtÁ¥ to_vec_inÁŽrepeatÁ¥ãHâ+ø¥Ánum_initÁø¥ãüHuniqueÁ¡UniqueÁ¢¥¢ ¢_markerÁ¡¦¥¡¨¥¡ª¥ªð ªØ5ªas_non_null_ptrÁªÉªÊ¡±¥±ƒ¡´¥¡¡¡
unsize_boxÁ collectionsÁºººãaddrÁ¿¥ invalid_mutÁÁ¥ GlobalÁÄ
   ȃ Ê> Ì×
AllocErrorÁÎ
ÒƒÕ×ÖÙ×TryReserveErrorÁÛ
݃  à
âÖä×TryReserveErrorKindÁæCapacityOverflowÁç
æûLélayoutÁé
ìƒïñÖó׈SpliceÁõøõšõõ(õ replace_withÁˆûøûšûû×Ñ¥¦A1ÁA2ÁØ Ñ¥¦Ø Ñ ¥ ¦   Ø Ñ¥¦Ø Ñ¥¦Ø ÑŸ ¥Ÿ ¦Ÿ Ÿ Ÿ Ø Ñ¥ ¥¥ ¦¥ ¥ ¥ Ø Ñ« ¥« ¦« « « Ø Ñ± ¥± ¦± ± Ÿ± ± · ± Ø ¹ Ñ » ¥» ¦» » Ÿ» » Á » Ø Ã 




!
"
#
0
0
0
2
3
4
5
6
7
8
9
;
<
=
>
?
@
«
²
Â
Ã
Ã
Å
É
É
Ê
Ê
Î
Î
Ï
Ï
Ð
Ð
Ñ
Ñ
Ò
Ò
Ö
Ö
Ý
Ý
â
ã
ã
ä
å
æ
ç
è
é
ê
ë
ì
í
î
ï
÷
ú
û
ý
«
«
«
¯
¯
¯
³
³
³
¸
¼
Á
Â
Ã
Ò
Ó
×
â
ã
ã
ç
ë
ï
ó
û
û
û
þ
˜
Ÿ
Ÿ
Ÿ
À
Á
Â
Ã
Ä
Å
È
É
Ê
Ë
Ì
Ð
Ñ
Ò
Ó
Ô
Ö
Ý


˜

œ

 
£
¤
§
§
©
Ã
Æ
Æ
Æ
Ë
Ì
Ò
Ó
Ö
Ù
Ý
ß
à
ã
å
è
õ
ö
ù
œ
œ
œ
 
¡
¢
£
§
²
³
¸
Â
Æ
Í
Ð
Þ
ß
à
ô
õ
ö
÷
ø
ù
ú
ü
ý
þ
ÿ



ƒ




Œ
Œ


š
š
š
š
¡
¡
¥
¥
¥
²
³
´
µ


·
¸
º
»
¼
½
¿
Ã
Ä
Å
É
Ê
Ê
Ë
×
ß
ä
é
ï
ó
÷
ø
ø
ü
ü
ƒ
ˆ
¤
©
°
µ
µ
¼
¼
À
Ç
Ç
Ç
Ë
Ï
Ó
×
Ø
Ú
Û
Ý
ó
ô

Ž


Ÿ
 
¯
°
³
É
Í
Í
Í
Ó
Ö
Ö
Ø
Ú
Ú
Ú
Þ
á
á
ã
å
å
å
í
ð
ð
ò
ô
ô
ô
ÿ
ÿ
ÿ








Œ
Œ
Œ










˜
˜



ž
ž
£
£
¤
¤
©
©
ª
ª
«
¯
¯
°
°
·
·
¹
¹
»
Á
Á
Á
Ã
Ã
Ã
ÕŠ ÄÄžL £‰]ÆÔ˜~Û´bØ´b³´b¿c´b1´bŠ ÎÎÏûL :á¤{‹®LgÛ’cØ’cÐì’cµß’c’c’c¿c’cÄcc1 8ÌìhhiˆlˆAmA ^†N-¤¥Žd dŒ"d³hhiˆlˆAmA ^†N-¤Ôd´b³hhiˆlˆAmA ^†N-¤
ÔdŽd³hhiˆlˆAmA ^†N-¤ØdØhhiˆlˆAmA ^†N-¤´bµßddíßddºddšed¢edéødÔd鄾„¾PinÁ†¾ ˜X$]È=„kt•ddéhhiˆlˆAmA ^†N-¤
¥ 8ÝhéhhiˆlˆAmA ^†N-¤Žd 8éhhiˆlˆAmA ^†N-¤
ºfféhhiˆlˆAmA ^†N-¤óe´bÔdŸðhhiˆlˆAmA ^†N-¤ÔdŸŽd¼eÄcd¿cdÎcdé!dö!dùMhhiˆlˆAmA ^†N-¤šŽdÅÙkŒMÙkÃMÙkòPÙkÃLhhiˆlˆAmA ^†N-¤
l´blؼe dÔd£dÔdàdÔdãdÔd“íd‚ØhhiˆlˆAmA ^†N-¤ŽdÐLúHúHßûHÁ‘4Ý­f‰úM÷fØÛÛÎMÜð}£û;™yµÐìÙnµßÙnÙnÙn¿cÙnØæçèÁNéûLêæNë
ZUVÒ—Ë4kÐì»oµß»o»o»o¿c»oéÙn»oé»oûØûØüØ LayoutErrorÁ :ð¨?¢©ÄcÙnÌ쥥¥¨µ ©Ëª¤Gâ@mÔdŽd ‰qŒ"‰q¿cõõµOù(âúãOâÙml¶ð™‡žøšähùMõõµOù(âúãOâÙml¶ð™‡ž8°rähŒMÀrÃMÀrŒ"Àr¿c»»è(¿)âÀŸ)âÁùâÂÁâÄ­KKtƒLÇ8Þhähà»»è(¿)âÀŸ)âÁùâÂÁâÄ­KKtƒLÇøÞhähÝh ªsÌìªsùMªsŒMªsŒ"ªsŒ"ééêâ+ ·pר`Ùëø+ø¥ÃMªsòPªs¿cà-€.â‹.âËâ¤âµ â˜þâš¿ÖN3ÔdŽdàŽvóeÌìŽv ŽvùMŽvŒMŽvÃMŽvòPŽvØŽvŒ"ŽvŒ"ÇÇÈâ+̈ý L ö!I8Þhähµßââöå€.âæâ¨ñ'N-yDÔd±Pââöå€.âæâ¨ñ'N-yD¦»Pµßââöå€.âæâ¨ñ'N-yDÞhíu 8
¦µß¹y 8þyµßêhââöå€.âæâ¨ñ'N-yDÿyíuµß 8Ýh¥zµßââöå€.âæâ¨ñ'N-yDÔdäh
¥yµßóeââöå€.âæâ¨ñ'N-yD¥yähµß»¾¿BorrowedÁÀˆÁÂOwnedÁÈ¢ÓÛ?'°UF8Ýh¥zµß{¥yŸµß¹y 8ÿyŸŒ"×׿2ÙÖÚã2Ö‚û_Ö
g;8Œ"ŽŽ˜7ÁâÏ7âä7â÷7âä¨ÓAoqá«8ÞhähŒ"§§®9«Û9⬴
â­Á‴¸ÌÔRRøÞhähÕÙÙÚŽ>܈â S™8ñÔdÔdé!ââöå€.âæâ¨ñ'N-yDÔdŽdö!ïØïšeïÙ¢{°r³"{°rÃLââöå€.âæâ¨ñ'N-yDÔd´bÔdÇLïÇL øââöå€.âæâ¨ñ'N-yDÞhähÇL øÉÐLïÔdÐLÉ øÞhíßïïïºïŒ"ï³ï€¿cïàïïãïïàïóeãïóeéââöå€.âæâ¨ñ'N-yDÞh´bêh麃ízéï€Êjéï¼eéïÚjé¼eïéââöå€.âæâ¨ñ'N-yDýi´b¶ið‘kïóeÔdŒ"â+ÁšÏIuÎo‚±£ÌøÞhähÌ좢™J¤ ¡¥·J¡§2º
Ôd ù…Øù…Š ù…ÆÄÐδ¢ÇÄÑÎÈÄÒοÛìæ¿ôâ±¢ÊijâÌÄÙάÛóæûõûÄâÄ9
ÔÎßÛîæÕÎÆÛïæââ â

Ÿ ⥠ « »± â» â×Î×Ûñæâ/ΨÛn¥Ö»¨¦¢q¥Ó»«¨¢¯¥ õå»ðéÃÍÇß׎®§½âËâÓâÚâß„¾÷ÛœæØâÛâÞâäâèâï⎰â¹â½h“õÙ»®Èh™õ໵Ôhõö»¹Ø»¼Ûh‰â令ÈâÐâðâÔâôúH¡â¬âÝÙþâââ
š
 Š ÇÛØ
³C¿c 1>Ðì
µßZÄc"Ìì !Œ" !íßSº
še
¢e
éðdÎc
é!ö!
ùM
ÅŒMÃMòPÃL 
£àã"“í‚ØÐLÕÙ¢³"ÇLü•%´ Ôž

¬ž
¬Ôd8- · ü‘1 hÔdŽd Á È ÇüÈŒ§d$‚ Ôd茎d,õŒù…ú呸Žd±@-¤0n$¸² Žd Á²²«ü‡²; Žd«² d ž²Š“m­>4‡% Ĥú$
 dú$
ºÔd´b>- %”%³üÕ$?¥¥¥¨µ ©Ëª¤Gâ@mÔd´b$ë$´bÄg Äå/œå/
Ό/
ÀÔd+7 ü/Y$ ˆ0
üâ/zRܘ0œ˜0
Œ˜0í•&2$¯0T ²0 ¾0
ü•0G0 Õ0
. Û0×ü·/¦¹,Ú/

Dϔ2
Δ2
Ôd,,£3üÖ2] ¥ÔdŽd ”3 ²3¹3 ¸3üß1Úº‰q$€2Žd,ó1§ ïíe¼îËè¿*ÔdŽdÙ¤Iylßc
\ßc
³Ôd+üÈcC âÔd´b ÿc Šd‘déü£cnï€$¹cà” ¬ìš,ûš 
$tìš
ºÔdŽd8J €›üÕšK âÔdŽd ”› Ÿ›¦›ü¥šïï$ÆšŽd,¹š‰qÒŽdФMfalseÁtrueÁÜìƒ
"´ì
žÔd3C  ÔdüÊr ¢Ôd »Ì¬ü¯ù…å‘ÑâšÌå‘Ì PhantomDataÁFu\»ŸÔd½µ Tx⚬ƒ
 4
ªÔd9D ž­üÕIå‘ù…âš6âšô®ü§Mâšù… .ìÄÜÆ
#
­Ôd3 W Ôd Óu–¤ à¡ èé¯ü™Ð Ôd¾ ù…†¥÷–¤÷–¤ÿå‘ùù…ù3\üð30 hÔdŽd!i-d8ù…@ŽdGNü¼)) éçuíu#ê0ééêâ+ ·pר`Ùëçuíut »»è(¿)âÀŸ)âÁùâÂÁâÄ­KKtƒLÇçuíuÕÜüî&% ÇÞhäh!È.ÇÇÈâ+̈ý L ö!IÞhähp à-€.â‹.âËâ¤âµ â˜þâš¿ÖN3Þhähçî¼¹¤ ÙÔdÚ)°4Ôd;Bí¯\~Á
ÔKTž
¹¤,
ÃÁ1
âÃÃHD•ÃäAÃåK\ȺÃüáúÌ allocator-api2 crate.ÁúíܯÜÁÛÔKÙ¹¤×ÃÁÖâÃÃHÕÃäÓAÃåKѺÃfilüh!c»œ–¬•üŒ A⃡º¾¿ÁÃHP¬ˆal Ô Memory allocation APIsÁ Ï×, `µ $;
§<A ­‚% èØ&Ôo\ÆûØ'¾L4…Ä(¾LÅ(¤ *§ +˜< ,ã  -handle_alloc_errorÁ”ý œ.$ õ÷Ä ê5ÝßTi»¤ŒUÌO4mÄŧ<  
¤,2  §d9  ˜<G  ã <P  ã4o ¾  L\w Á ûLT Î ûLÏ è 1   èØ &” Í” À²´¤¦˜l_ } suQSCE\í ´bü•W   Å  Å ´bèØèØ éØ²‚êØŸ²‚ªë¥CHÈÖ¿Ù¿Ú¿«Û¿ˆÜ¿Ý¿Þ¿ˆ‚†f|Â
§ ïíe¼îËè¿*üi’c £ 
 æN4ª zeroedÁ4º üš   Æ  Æ ´b§ ïíe¼îËè¿*ýiݳݳ´ · 
 µ Æ 
old_layoutÁTà 
new_layoutÁTü Æ´4˜
üï ´b !"#234567!#" ü¬G  Ç  Ç ´bݳ´ ¸ 
 æN4¿ ü¾N  È  È ´bݳ´ Ñ 
 æN4Ø üÖ=  É  É ´b„¶ݳ ë 
 µ ò æN4„ üˆ" $" Ê  Ê ´b„¶ݳݳ´  " 
!$¡" µ ¯" æµTÉ" øµTå" üÌ$¢ \Ö$ Ë  Ë ´b„¶ݳݳ´ ë$ 
"$ì$ µ ú$ æµT”% øµT°% ü–' 4 ' Ì  Ì ´b„¶ݳݳ´ °' 
#$±' µ ¿' æµTÙ' øµTõ' «®Ÿ¢¤÷”çpsehZ]ORüé&7ü c0Åc0ü·8ºÍ Î Ï  Í c Î  c cˆ¢cµ
 `£c€. `àB¤GS
Ï Ö¿Ù¿Ú¿«Û¿ˆÜ¿Ý¿Þ¿ˆ‚†f|Â
ŸÈŸÈ ÈÃ éBL/ ¾/
0$¿± ÅÔ×ü«c` An implementation of `Allocator` can allocate, grow, shrink, and deallocate arbitrary blocks ofÁü $! data described via [`Layout`][].Á´ úü¸ c` `Allocator` is designed to be implemented on ZSTs, references, or smart pointers because havingÁüœ
^[ an allocator like `MyAlloc([u8; N])` cannot be moved, without updating the pointers to theÁ¬û
 allocated memory.Á úü• a^ Unlike [`GlobalAlloc`][], zero-sized allocations are allowed in `Allocator`. If an underlyingÁü÷ UR allocator does not support this (like jemalloc) or return a null pointer (such asÁüÍ ?< `libc::malloc`), this must be caught by the implementation.Á
úü‘
" ### Currently allocated memoryÁ´
úü¸
c` Some of the methods require that a memory block be *currently allocated* via an allocator. ThisÁ means that:Á¬úü°fc * the starting address for that memory block was previously returned by [`allocate`], [`grow`], orÁ¬— [`shrink`], andÁ­úü±a^ * the memory block has not been subsequently deallocated, where blocks are either deallocatedÁü“_\ directly by being passed to [`deallocate`] or were changed by being passed to [`grow`] orÁüóa^ [`shrink`] that returns `Ok`. If `grow` or `shrink` have returned `Err`, the passed pointerÁ¤Õ remains valid.Áêúüî%" [`allocate`]: Allocator::allocateÁì” [`grow`]: Allocator::growÁü²! [`shrink`]: Allocator::shrinkÁüÔ)& [`deallocate`]: Allocator::deallocateÁþú´‚ ### Memory fittingÁúüa^ Some of the methods require that a layout *fit* a memory block. What it means for a layout toÁüÿb_ "fit" a memory block means (or equivalently, for a memory block to "fit" a layout) is that theÁüâ# following conditions must hold:ÁúüŠTQ * The block must be allocated with the same alignment as [`layout.align()`], andÁßúüãQN * The provided [`layout.size()`] must fall in the range `min ..= max`, where:ÁüµUR - `min` is the size of the layout most recently used to allocate the block, andÁü‹\Y - `max` is the latest actual size returned from [`allocate`], [`grow`], or [`shrink`].Áèúüì%" [`layout.align()`]: Layout::alignÁü’# [`layout.size()`]: Layout::sizeÁú # SafetyÁÇúüËc` * Memory blocks returned from an allocator must point to valid memory and retain their validityÁü¯;8 until the instance and all of its clones are dropped,ÁëúüïZW * cloning or moving the allocator must not invalidate memory blocks returned from thisÁüÊLI allocator. A cloned allocator must behave like the same allocator, andÁúü›_\ * any pointer to a memory block which is [*currently allocated*] may be passed to any otherÁôû method of the allocator.Ášúüž85 [*currently allocated*]: #currently-allocated-memoryÁ11Îìü×íb1ü×ü×234567823456785378642ü½%Hüø+( Attempts to allocate a block of memory.Á¨úü°kh On success, returns a [`NonNull<[u8]>`][NonNull] meeting the size and alignment guarantees of `layout`.Á úü¨_\ The returned block may have a larger size than specified by `layout.size()`, and may or mayÁüŒ&# not have its contents initialized.Á·úd¿ # ErrorsÁÐúüØWT Returning `Err` indicates that either memory is exhausted or `layout` does not meetÁü´ .+ allocator's size or alignment constraints.Áç úüï `] Implementations are encouraged to return `Err` on memory exhaustion rather than panicking orÁüÔ!]Z aborting, but this is not a strict requirement. (Specifically: it is *legal* to implementÁü¶"^[ this trait atop an underlying native allocation library that aborts on memory exhaustion.)Á™#úü¡#]Z Clients wishing to abort computation in response to an allocation error are encouraged toÁüƒ$`] call the [`handle_alloc_error`] function, rather than directly invoking `panic!` or similar.Áè$úüð$HE [`handle_alloc_error`]: ../../alloc/alloc/fn.handle_alloc_error.htmlÁDÀ%Ð  Ð „Øݳ´1 É%1
2„Ø$Ê%æN4Ð%
returned.Á¶Lúü¾LSP The memory block will contain the following contents after a successful call toÁ”–M `grow_zeroed`:Áü­MPM * Bytes `0..old_layout.size()` are preserved from the original allocation.Áü‚N\Y * Bytes `old_layout.size()..old_size` will either be preserved or zeroed, depending onÁüãN]Z the allocator implementation. `old_size` refers to the size of the memory block priorÁüÅOXU to the `grow_zeroed` call, which may be larger than the size that was originallyÁü¢P(% requested when it was allocated.ÁüÏPZW * Bytes `old_size..new_size` are zeroed. `new_size` refers to the size of the memoryÁü®Q1. block returned by the `grow_zeroed` call.ÁäQúdìQçÑýQúü…RUÞïüßRb½ðüÆSO©ñšTúü¢TPŽò÷TúüÿT8©Öä¼UýæÝUúdåUËÚöUúüþUT´óü×V@’ôœWúü¤W`’Üü‰X]üÜüëX^ãÝÎYúüÖY]×Þü¸Z`¾ß[úü¥[H´à\’\Ô  Ô „Ø„¶ݳݳ´1 §\1
6„Ø$¨\µ ¶\æµTÐ\øµTì\ü­uü›d(% Attempts to shrink the memory block.ÁÈdúüÐdfÎèü»e]¾éüf\Y this, the allocator may shrink the allocation referenced by `ptr` to fit the new layout.Áþfúü†gY—ëüägaúëüÊhXU allocation was shrunk in-place. The newly returned pointer is the only valid pointerÁü§i"ÆíÎiúüÖi`þíü»jGèî‡kúdkçÑ kúü¨kUÞïü‚lb½ðüélOL * `new_layout.size()` must be smaller than or equal to `old_layout.size()`.Á½múüÅmPŽòšnúü¢n8©Öäßnýæ€oúdˆoËÚ™oúü¡oT´óüúoB? constraints of the allocator, or if shrinking otherwise fails.ÁÁpúüÉp`’Üü®q]üÜür^ãÝórúüûr]×ÞüÝs`¾ßÂtúüÊtH´à4·uÕ  Õ „Ø„¶ݳݳ´1 Çu1
7„Ø$Èuµ ÖuæµTðuøµTŒvüñ~8ü²}FC Creates a "by reference" adapter for this instance of `Allocator`.Áý}úü…~QN The returned adapter also implements `Allocator` and will simply borrow this.Á4ô~Ö  Ö „Ø…‹1 û~1Íì„Ø
8„Ø$ü~üÆ@8× ::× ÎìŽd Ò1Žd‰d;<=>?@234567;><@?=EGü£€GD¦€Ø  Ø ‰dݳ´9 ¯€9
;8Žd$°€æN4¶€ü°NÙ  Ù ‰dݳ´9 Ã9
<8ŽdæN4ÊüË‚=TÕ‚Ú  Ú ‰d„¶ݳ9 à‚9
=8Žd$Ⴕ ç‚æN4ù‚ü¤„$®„Û  Û ‰d„¶ݳݳ´9 ¼„9
>8Žd$½„µ Ë„æµT儸µTü冢\ï†Ü  Ü ‰d„¶ݳݳ´9 „‡9
?8Žd$…‡µ “‡æµT­‡øµTɇü´‰4¾‰Ý  Ý ‰d„¶ݳݳ´9 Ή9
@8Žd$ωµ ݉æµT÷‰øµT“Šü*' The `Box<T>` type for heap allocation.Á+úü/NK [`Box<T>`], casually referred to as a 'box', provides the simplest form ofÁü~MJ heap allocation in Rust. Boxes provide ownership for this allocation, andÁüÌNK drop their contents when they go out of scope. Boxes also ensure that theyÁü›0- never allocate more than `isize::MAX` bytes.ÁÌú # ExamplesÁßúüãB? Move a value from the stack to the heap by creating a [`Box`]:Á¦ú ```Á¤² let val: u8 = 5;ÁüÇ'$ let boxed: Box<u8> = Box::new(val);Á¾•÷úüûEB Move a value from a [`Box`] back to the stack by [dereferencing]:ÁÁú¾•üÍ%" let boxed: Box<u8> =
TQ for a `Cons`. By introducing a [`Box<T>`], which has a defined size, we know howÁÜŒ  big `Cons` needs to be.Á¨ úœ¬  # Memory layoutÁÀ úüÄ NK For non-zero-sized values, a [`Box`] will use the [`Global`] allocator forÁü“ LI its allocation. It is valid to convert both ways between a [`Box`] and aÁüà GD raw pointer allocated with the [`Global`] allocator, given that theÁü¨
OL [`Layout`] used with the allocator is correct for the type. More precisely,Áüø
KH a `value: *mut T` that has been allocated with the [`Global`] allocatorÁüÄGD with `Layout::for_value(&*value)` may be converted into a box usingÁüŒPM [`Box::<T>::from_raw(value)`]. Conversely, the memory backing a `value: *mutÁüÝHE T` obtained from [`Box::<T>::into_raw`] may be deallocated using theÁü¦=: [`Global`] allocator with [`Layout::for_value(&*value)`].ÁäúüèNK For zero-sized values, the `Box` pointer still has to be [valid] for readsÁü·KH and writes and sufficiently aligned. In particular, casting any alignedÁüƒMJ non-zero integer literal to a raw pointer produces a valid pointer, but aÁüÑMJ pointer pointing into previously allocated memory that since got freed isÁüŸOL not valid. The recommended way to build a Box to a ZST if `Box::new` cannotÁüï1. be used is to use [`ptr::NonNull::dangling`].Á¡úü¥EB So long as `T: Sized`, a `Box<T>` is guaranteed to be representedÁüëB? as a single pointer and is also ABI-compatible with C pointersÁü®B? (i.e. the C type `T*`). This means that if you have extern "C"ÁüñC@ Rust functions that will be called from C, you can define thoseÁüµFC Rust functions using `Box<T>` types, and use `T*` as correspondingÁüüC@ type on the C side. As an example, consider this C header whichÁüÀA> declares functions that create and destroy some kind of `Foo`ÁT value:ÁúD‘ ```cÁ”š /* C header */Á­úü±)& /* Returns ownership to the caller */ÁôÛ struct Foo* foo_new(void);ÁúúüþGD /* Takes ownership from the caller; no-op when invoked with null */ÁüÆ! void foo_delete(struct Foo*);Á¾•ðúüôJG These two functions might be implemented in Rust as follows. Here, theÁü¿IF `struct Foo*` type from C is translated to `Box<Foo>`, which capturesÁü‰FC the ownership constraints. Note also that the nullable argument toÁüÐOL `foo_delete` is represented in Rust as `Option<Box<Foo>>`, since `Box<Foo>`Áœ  cannot be null.Á´ú¾• #[repr(C)]ÁœÏ pub struct Foo;Áãú„ç
#[no_mangle]Áüø-* pub extern "C" fn foo_new() -> Box<Foo> {Á¬¦ Box::new(Foo)ÁÆ™Âú„ÆÒ´ü×85 pub extern "C" fn foo_delete(_: Option<Box<Foo>>) {}Á<¾•˜úüœNK Even though `Box<T>` has the same representation and C ABI as a C pointer,ÁüëMJ this does not mean that you can convert an arbitrary `T*` into a `Box<T>`Áü¹LI and expect things to work. `Box<T>` values will always be fully aligned,Áü† LI non-null pointers. Moreover, the destructor for `Box<T>` will attempt toÁüÓ KH free the value with the global allocator. In general, the best practiceÁüŸ!HE is to only use `Box<T>` for pointers that originated from the globalÁtè! allocator.Á÷!úüû!>; **Important.** At least at present, you should avoid usingÁüº"B? `Box<T>` types for functions that are defined in C but invokedÁüý"EB from Rust. In those cases, you should directly mirror the C typesÁüÃ#A> as closely as possible. Using types like `Box<T>` where the CÁü…$DA definition is just using `T*` can lead to undefined behavior, asÁüÊ$A> described in [rust-lang/unsafe-code-guidelines#198][ucg#198].ÁŒ%úü%$! # Considerations for unsafe codeÁµ%úü
±Ý´bŠŠ
ŒÔdû™üÞŸAüîšMJ Constructs a new boxed slice with uninitialized contents, with the memoryÁüÀ› òÝå›úüí›S¨ÞœÅœ„ßÝœútåœÔøœú<€¾•ÜŒçØ¬úü´30 let values = Box::<[u32]>::new_zeroed_slice(3);Áüì1. let values = unsafe { values.assume_init() };Á¢žúüªž" assert_eq!(*values, [0, 0, 0])Á<Ñž¾•Ýžúüåž&›áùÖ´šŸÄ™ŸüŸ#.\¸Ÿ„åŸÒ›ŠŠ
ÔdöŸü„¦Yüð QN Constructs a new boxed slice with uninitialized contents. Returns an error ifÁÄÆ¡ the allocation failsÁã¡útë¡Ôþ¡ú<†¢¾•ü’¢*ÅìÁ¢úüÉ¢<9 let mut values = Box::<[u32]>::try_new_uninit_slice(3)?;ÁÌŠ£É—ü¨£#úÙüУ(ü—üý£(¯˜üª¤(â˜äפ¡™4ø¤‚Ûƒ¥úü‹¥# assert_eq!(*values, [1, 2, 3]);Áü³¥*æé<⥾•¤‹¦Ö¿Ù¿Ú¿«Û¿ˆÜ¿Ý¿Þ¿ˆ‚†f|Â
Ò›’cŠŠ
ŽÔd ¦üìYüž§MÄ›üð§IF being filled with `0` bytes. Returns an error if the allocation failsÁ¾¨úüƨS¨Þœž©„ß¶©út¾©ÔÑ©ú<Ù©¾•üå©*Å씪úüœª85 let values = Box::<[u32]>::try_new_zeroed_slice(3)?;ÁüÙª1ä«úü—«# assert_eq!(*values, [0, 0, 0]);Áü¿«*æé<•ú«úü‚¬&›á¤Ê¬Ö¤ŠŠ
Ôd߬üÛ­!¥ÈÕ à­æÑ ã­ŒLæ­¼e“)+-/üɳQüƒ®WT Constructs a new boxed slice with uninitialized contents in the provided allocator.Áß®útç®Ôú®ú<‚¯¾•üޝ*Å콯úÜů°õå¯úüí¯EB let mut values = Box::<[u32], _>::new_uninit_slice_in(3, System);Á·°úÌ¿°É—üݰ#úÙü…±(ü—ü²±(¯˜üß±(☌²ú䔲¡™4µ²‚ÛÀ²úüȲ"ã™<ï²¾•ùÖ´…³Ä„³üû²#.\£³œÐ³ŽdhhiˆlˆAmA ^†N-¤‰œŽd
ÔdŽd䳤,ð³ü½ºQüî´WT Constructs a new boxed slice with uninitialized contents in the provided allocator,Áüʵ0- with the memory being filled with `0` bytes.Áÿµúü‡¶S¨Þœß¶„ß÷¶útÿ¶Ô’·ú<𷾕ü¦·*ÅìÕ·úÜÝ·°õý·úü…¸A> let values = Box::<[u32], _>::new_zeroed_slice_in(3, System);Áü˸1ä¹úü‰¹"­ž<°¹¾•¼¹úüĹ&›áùÖ´ù¹Äø¹üï¹#.\—ºœÄºŽdÁ®
ÔdŽdغ¤,äºüÆÁ{üé»kh Constructs a new boxed slice with uninitialized contents in the provided allocator. Returns an error ifÁÌÙ¼ the allocation fails.Á÷¼útÿ¼Ô’½ú<𽾕ü¦½*ÅìÕ½úÜݽ°õý½úü…¾JG let mut values = Box::<[u32], _>::try_new_uninit_slice_in(3, System)?;ÁÌԾɗüò¾#úÙüš¿(ü—üÇ¿(¯˜üô¿(â˜ä¡À¡™4ÂÀ‚ÛÍÀúüÕÀ#ù¢üýÀ*æé<¬Á¾•¼ÍÁŽdÖ¿Ù¿Ú¿«Û¿ˆÜ¿Ý¿Þ¿ˆ‚†f|Â
Á®’c
ÔdŽdîÁ¤,‚ÂüáËüóÅgd Constructs a new boxed slice with uninitialized contents in the provided allocator, with the memoryÁü߯JG being filled with `0` bytes. Returns an error if the allocation fails.Á®Çúü¶ÇS¨ÞœŽÈ„ߦÈút®ÈÔÁÈú<ÉȾ•üÕÈ*Åì„Éú܌ɰõ¬Éúü
,”áüõá"øáæ ç  æ d ç dÆ ûáÆ
ÊÔdŽd$üá¹
,‚âüÌâC¥ÌÍÌÍÖÑ ÑâæÑ éâíßÔdÔdTÝâŒLìâÏÐÑÒïßðßñßóßòßÒÎÐÑÏjlnpü¬ã7\¯ãè é  è d é dÛ¼ݼÞ¼©ß¼à¼ÛἈcSñŸ«‡zÙ¿ßÀßÁßLessÁÂßÃßÄß~Å߯ßÇßGreaterÁÈßåºÝÈnûê7Ë »ãË
ÎÔdŽd$¼ã¹
,Âãü¹ä"¼äê ë  ê d ë dË ¿äË
ÏÔdŽd$Àä¹
,Æäü¨å"«åì í  ì d í dË ®åË
ÐÔdŽd$¯å¹
,µåü—æ"šæî ï  î d ï dË æË
ÑÔdŽd$žæ¹
,¤æü†ç"‰çð ñ  ð d ñ dË ŒçË
ÒÔdŽd$ç¹
,“çüÞç5¥ÔÕÕÔÖÑ ãçæÑ ôçºÔdïçŒL÷ç»Ö579;ü°è'³èò ó  ò d ó d›ºÓ ·èÓ
ÖÔdŽd$¸è¹
,¾èü‡é3¥ØÙØÙÖÑ ŒéæÑ œéÔd˜éŒLŸéd*,.0ü¿é7¥ÛÜÜÛÖÑ ÄéæÑ ÖéšeÔd$ÐéŒLÙé›eÝ579;ü“ê($–êô õ  ô d õ ÚÞÞ ¦êÚÍìÄà ›ê¢eÄÃ4žê
ÝÔdŽdÄÃ$§êº,­ê68üåê;¥àááàÖÑ êêæÑ þê¢eÔd4öêŒLëãäåæçèéêëìíîï£e¤e¥e¦e§e¨e©eªe«e¬e­e®e¯e°eèäëïçãîêæâíéåìÄÆÈʼ½ë4Àëö  ö dß Çëß
âÔdŽd$Èëü‘ì!,”ì÷ ø  ÷ d ø üiß šìß
ãÔdŽd$ŸìbytesÁ,¥ììóìDöìù  ù dýiß ÿìß
äÔdŽd$„í´ ŠíüÐíLÓíú  ú dß Ýíß
åÔdŽd$âí´ èíü°îL³îû  û dß ½îß
æÔdŽd$Âî´ ÈîüïL“ïü  ü dß ïß
çÔdŽd$¢ï´ ¨ïüðï!Tóïý  ý dß þïß
èÔdŽd$ƒð´ ‰ðüÓð#\Öðþ  þ dß âðß
éÔdŽd$çð´ íðì¹ñD¼ñÿ  ÿ dß Åñß
êÔdŽd$Êñ´ Ðñü–òL™ò
 
dß £òß
ëÔdŽd$¨ò´ ®òüöòLùò
 
dß ƒóß
ìÔdŽd$ˆó´ ŽóüÖóLÙó
 
dß ãóß
íÔdŽd$èó´ îóü¶ô!T¹ôƒ
 ƒ
dß Äôß
îÔdŽd$Éô´ Ïôü™õ#\œõ
 
dß ¨õß
ïÔdŽd$­õ´ ³õÔŒöùÖ´òõÄñõüèõ#¥ññÈÕ ‘öødòëò¬ñøü­ö" Converts a `T` into a `Box<T>`ÁÔöúüÜö63 The conversion allocates on the heap and moves `t`ÁÜ—÷ from the stack into it.Á·÷út¿÷ÔÒ÷ú\Ú÷ ```rustÁtê÷ let x = 5;Áäý÷ let boxed = Box::new(5);Ážøúü¦ø$! assert_eq!(Box::from(x), boxed);Á<Ïø¾•$ôøÔdødðð
òÔd¿ ùøü¦ùV¥ôõôõÖÑ «ùæÑ ¶ùŒL¹ùŒ‘<ôùågöëö.024ü¨ÿ!üƒúWå—üßú=ǘ¡ûúü©ûGõûúüýû1. This is also available via [`Box::into_pin`].Á³üúü»ü[X Constructing and pinning a `Box` with <code><Pin<Box\<T>>>::from([Box::new]\(x))</code>Áü›ýIךüéýSP This `From` implementation is useful if you already have a `Box<T>`, or you areÁüÁþL…œ$«ÿdågóó
öÔdŽdä,°ÿü–€@ùÖ´üÿÄûÿüòÿ#8
¥øùù
øÍìÞh ›€Íìäh ¤€Š Þh$ž€1ähL§€³äh<³€¦húëúSUOQü£„#üÝ€'$ Converts a `&[T]` into a `Box<[T]>`Áúü‘)& This conversion allocates on the heapÁü¿41 and performs a copy of `slice` and its contents.Áøút€‚Ô\“‚×Óü£‚>; // create a &[u8] which will be used to create a Box<[u8]>Áüæ‚2/ let slice: &[u8] = &[104, 101, 108, 108, 111];Áüƒ2/ let boxed_slice: Box<[u8]> = Box::from(slice);ÁÔƒúü܃  println!("{boxed_slice:?}");Á<¾•$¦„
 
Ýh¦h÷ ²„÷
ú8Þhähž,«„üé†7ùÖ´Ï†ÄΆüņ#8
ü
üæÑ Lñ†ͧ<ý†úhýëý%'üщü§‡'$ Converts a `&str` into a `Box<str>`ÁÓ‡úüÛ‡)Üü‰ˆ and performs a copy of `s`.Á­ˆútµˆÔȈú\Ј×Óüàˆ-* let boxed: Box<str> = Box::from("hello");ÁÄ’‰ println!("{boxed}");Á<¯‰¾•$Ô‰ˆ
 ˆ
úhû ܉û
ý8Žd¾ Ù‰ü•‹5ÿÿô¨ š‹…©LÅi€ëü²üÑ‹,) Converts a `Box<str>` into a `Box<[u8]>`Á‚ŒúüŠŒGÖŒútÞŒÔ\ñŒ×ÓüA> // create a Box<str> which will be used to create a Box<[u8]>ÁüÇ-µâüù0- let boxed_str: Box<[u8]> = Box::from(boxed);Á®Žúü¶Ž>ÝüùŽ2æÝü°'$ let boxed_slice = Box::from(slice);ÁÜúüä'$ assert_eq!(boxed_slice, boxed_str);Á<¾•fÅiþþ
ºf¾ ºüÖ‘4¥ƒŸƒÈÕ Û‘æÑ Þ‘Ÿt쑌Lá‘Új†/1351 ò‘ü§’$,®’Új¼e
ÔdŽdŸ­ ´’üÅ“BDÌ“ÚjïŒLý“
ÔdŽdŸ$Õ“üÔ•1ùÖ´º•Ĺ•ü°•#¥ŸŠŠÈÕ Ù•ŸtÜ•ëŒ"$ â•ü°˜"üŒ–)& Converts a `[T; N]` into a `Box<[T]>`Áº–úü–C@ This conversion moves the array to newly heap-allocated memory.ÁŠ—út’—Ô¥—ú\­—×Óü½—-* let boxed: Box<[u8]> = Box::from([4, 2]);ÁÔï— println!("{boxed:?}");Á<Ž˜¾•$³˜Êjjˆˆ
ŒÔdŸÇ,¸˜ü‚™M¥ŸÈÕ ‡™æÑ Š™‹êt˜™ŒLÚj“òó579;= ž™TÖ™,Û™ŽŽ¼eü»œBüõ™:7 Attempts to convert a `Box<[T]>` into a `Box<[T; N]>`.Á´šúü¼š96 The conversion occurs in-place and does not require aÁÔúš new memory allocation.Á™›úd¡›ËÚ²›úüº›63 Returns the old `Box<[T]>` in the `Err` variant ifÁüõ›+( `boxed_slice.len()` does not equal `N`.ÁD¾œ¼eÖ¿Ù¿Ú¿«Û¿ˆÜ¿Ý¿Þ¿ˆ‚†f|Â
ÚjÚj¼eòŽŽ
ÔdŽdŸÀ\Çœüöž"ô¨ ûž…©LþžhhiˆlˆAmA ^†N-¤ì%ºf˜šXZü¦£8üŸŸ30 Attempt to downcast the box to a concrete type.ÁןútߟÔòŸú<úŸ¾•´†  use std::any::Any;Á¡ úü© -* fn print_if_string(value: Box<dyn Any>) {ÁüÛ 85 if let Ok(string) = value.downcast::<String>() {Áü˜¡>; println!("String ({}): {}", string.len(), string);ÁLÛ¡ý ,顯™ó¡úüû¡.+ let my_string = "Hello World".to_string();Áü®¢)& print_if_string(Box::new(my_string));ÁüÜ¢# print_if_string(Box::new(0i8));Á<„£¾•D­£èõÖ¿Ù¿Ú¿«Û¿ˆÜ¿Ý¿Þ¿ˆ‚†f|Â
hhiˆlˆAmA ^†N-¤Þhºfèõ¥¸Û ¶£ì%Þh¹£
˜ºfÞh$¾£(*üÛ©;üó¤)& Downcasts the box to a concrete type.Á¡¥úü©¥,) For a safe alternative see [`downcast`].ÁÚ¥útâ¥Ôõ¥ú<ý¥¾•ü‰¦# #![feature(downcast_unchecked)]Á±¦ú´¹¦ÄöÔ¦úüܦ,) let x: Box<dyn Any> = Box::new(1_usize);Á§úd•§©áü¦§85 assert_eq!(*x.downcast_unchecked::<usize>(), 1);Á,ã§Æ™<í§¾•ù§úd¨çÑ’¨úüš¨@= The contained value must be of type `T`. Calling this methodÁüߨ41 with the incorrect type is *undefined behavior*.Á˜©úü ©  [`downcast`]: Self::downcastÁ”é©èõêû¥¸Û ü©Ôüÿ©
šºfÞh$„ª!#üí«)ô¨ ò«…©Lõ«hhiˆlˆAmA ^†N-¤ì%Ììºfž ^`ü«°8ü¬3
Š

 
d Š
 c cˆ¢cµ
 `£c€. `àB¤GS

²¾¨ ®Ç¨
«ÔdŽd$¯Ç± µÇü‘ÈC¥­®­®ÖÑ –龄 ®È¿cÔdT™ÈŒL±ÈÀc¯579;üñÈ8ôÈŒ

Ž
 Œ
d 
 c cˆ¢cµ
 `£c€. `àB¤GS
Ž
²¾¬ øÈ¬
¯ÔdŽd$ùȱ ÿÈüÙÉ8¥±²±²ÖÑ ÞÉæÑ éÉŒLìÉÏc³%')+ü®Ê8±Ê


 
d 
 c cˆ¢cµ
 `£c€. `àB¤GS

²¾° µÊ°
³ÔdŽd$¶Ê± ¼ÊüËÌ1¥µµÖÑ ÐÌæÑ ÛÌŒLÞ̸ê!ë!¸,.02\ƒÍ4ˆÍ´´Ôd¬¯Í,²Í
 
d 
Ôd´ ¸Í´
¸ÔdŽd$¹ÍüóÍ4¥º»º»ÖÑ øÍæÑ ƒÎŒL†Î÷!¼%')+üÄÎ!LÇÎ
 
d 
Ôd¹ Ñι
¼ÔdŽd$ÖÎü”Ï?š¾¿¿¾Îìl ™ÏæÑ ¯ÏùMlDœÏŒL²ÏÙkÀÁÂÃÄúMûMÿMNƒNÄÂÃÁ]_acLÚÏ$ßϽ½lúMüŠÐ%$Ð
 
ÙkÛ¼ݼÞ¼©ß¼à¼ÛἈcSñŸ«‡zÙ顽 ’н
ÁlŽd$—ÐüëÐ-LîÐ
 
ÙkÛ¼ݼÞ¼©ß¼à¼ÛἈcSñŸ«‡zÙ½ øÐ½
ÂlŽd$ùÐüÙÑ.ÜÑ
 
Ùk¦¢½ àѽ
ÃlŽd$åѹ ëÑüÃÒ $ÆÒÙk¦¢½½
ÄlŽd$ËÒl‹Ó<‘ÓAÅÅü×ü‹ÓIÅü×ü× ÆÇÆÇÍì„ØÆTŸÓʦ ÇLŸÓ$¤ÓAÅÅü®Ó$$±ÓA„ØÛ¼ݼÞ¼©ß¼à¼ÛἈcSñŸ«‡zÙÒ¦ÅÅ
Ç„Ø$¶ÓüÖÓ>šÉÊÊÉΠ Û ñÓè DÞÓŒLôÓÙkËÌÆÇÌ579;L›Ô$ ÔAÈÈé¡üËÔ $ÎÔAÙk¦¢ÈÈ
ÌlŽd$ÓÔüÕ+$“ÕAÛ¼ݼÞ¼©ß¼à¼ÛἈcSñŸ«‡zÙÔdÔd¦ª¥ÎÎÈÕ ˜Õ
ÍÔd ›Õà ©Õ ü„ÖUšÐÑÐÑΠ ‰ÖæÑ ªÖŒMlœŒÖŒL­ÖÙkÒÓMMÒÓ@BDFüöÖ*LùÖ
 
Ùk¦¢Ï ƒ×Ï
ÒlŽd$ˆ×üà×3Dãט
 ˜
Ùk¦¢Ï ì×Ï
ÓlŽd$ñ×¹ ÷×ü¼ØQšÕÖÖÕΠ ÁØæÑ àØÃMlŒÄØŒLãØÙk×ÄM×579;´ªÙ­Ù
 
ÙkÔ ±ÙÔ
×lŽd$²ÙüãÙIšÙÚÙÚΠ èÙæÑ ƒÚòPllëÙŒL†ÚÙk*,.0üÕÚ$ùÖ´»ÚĺÚü±Ú#šÜÜÍìl ÚÚÈlÝÅLÝü–Û8L™ÛÞhÈlÛ¥ÞÞÛ¸Û £ÛÇLÞh´¦ÛÞhÈLlD³Û
ÝlÞhù$¾Û;=ü¾Ü:ùÖ´¤ÜÄ£ÜüšÜ#¥àááàÈÕ ÃÜæÑ ÍÜåª,ÆÜŒLÐÜþª,ÜܼeâãÙÚãâBDFH¼•Ý,˜Ýš
 š
¼e¼eß žÝß
âÔdŽd$ŸÝü†ß&T‰ß
œ
 
¼e œ
¼eß ”ßß
ãÔdŽd$™ß¹
,ŸßüÇà=¥åææåÖÑ ÌàæÑ ×àŒLÚà¢ç%')+´¡á4¤á
 
d 
Ôdä «áä
çÔdŽd$¬áüÐá@¥éêéêÖÑ ÕáæÑ àáŒLãá¥ë%')+ü­â"T°âž
 ž
d ž
Ôdè »âè
ëÔdŽd$Àâüèâ4¥íîîíÖÑ íâæÑ øâŒLûââï%')+´¹ã4¼ãŸ
 Ÿ
d Ÿ
Ôdì Ããì
ïÔdŽd$Äãüèã4¥ñòòñÖÑ íãæÑ øãŒLûãåó%')+ô¹ä4¼ä 
  
d  
Ôdð Ãäð
óÔdŽd$Èäü²íB¥õöõöÖÑ ·íæÑ ÂíŒLÅ팑<ííd#%')üùíYøùùøÎì‘n þíæÑ šî‚Ø‘n4Šî“í‘n,“îŒL<ÊîÚmúûƒØ„ØûY[]_\Ùî4Þî÷÷‘nƒØüïM$ï¡
¢
£
„¾„¾ñf†¾ ˜X$]È=„kt• ¡
Úm ¢
ÌÌkÎwakerÁ¸Ï local_wakerÁ¸ÐextÁ¸Ñ·J¸Ò_marker2Á¸f'EwÚ]¾å£
œØžØŸØÈ Øˆ¡Ø¢Ø´‰‰Nµý¤ÃÚmƒØ÷ £ï÷
û‘nŽd$™ïcxÁ¯ïüà•F»¤ŒÌ•ÌÆ•ýýô¨ å•…©Lè•¡nþÒLþü­–B4°–¤
 ¤
¡n°rüšÿÿ Ü–üÍì°r ·–ÇL°rüº– °rÈLf”Ç–
þºf°r$á–ù$ç–DFD”—þ<closure_kind>Á<closure_signature>Á<upvars>Áþºf°rf ¡n»¤ŒàÌÚ ¥ÖÞàáæÛÔo\ûØí$.ë ManuallyDropÁd4ÃÛ½Ê\BÑÛDropÁ$_Œ"µ $u§<{Šž,‰f¡×¦ `Žè1¾L4ÑÄ(¾LÅ( èØ&ã ¾ˆùh œ.ÁN„‚çÁNèûLTÈéĽL"®(|TtLifoX[\‰N@C14”±*-òôÝßTòÐüª ¤áÙn˜ü·)üü63 Details about the allocation that caused the errorÁ$¾¥
 ¥
Ùn»o Ã
˜œèü 2Ùn›ëüÐ *»oÙnšš
üœ
.»oëü® üÑ
B? Always evaluates to [`TryReserveErrorKind::CapacityOverflow`].Á$± Ãp»oœœ
 ü‡ %ÙnŸÅcŸü³ v ¦
§
¨
 ¦
Ùn §
 c cˆ¢cµ
 `£c€. `àB¤GS
¨
²¾ž à ž
Ÿ ×Ò ùÖ´ªÄ©ü # ¡¢ø£¤ _L‚÷ _L‚÷¡¢£¤¢¤l“  ÅÏ  ÅÏ  ÅÏ  ÅÏüž2¥¦§¦§ÈÕ ·æÑ¬ºŒ‰qGâ@m¨©ªÝ469 º´b×¥¥âšì¥¥¥¥ŽdüäR¥¬­­¬ÈÕ ðæÑ óŒôÓ„Ô‰q'),.ü—!R¥¯°°¯ÈÕ £!æÑ ¦!ŒL©!òÔ$×!Õ$ä!‰q'),.Ìï!¥²²ÈÕ ô!à”³´µÔÕ$.\Å$â$à”±±Ø›üà)-ùÖ´œ)Ä›)ü’)#.\º)lç)à”±±
´Ôdþ Dõ)üÝ+4ùÖ´™+Ę+ü+#.\·+¤ä+à”±±
µÔdþ Dù+üÕ,"¥·¸¸·ÈÕ Ú,æÑ Ý,ŒLà,‰q¹º»¼½¾¿ÀÁÂÃÄÈÉÊËÌJLOQü·/(„È/üß1%4ì1Žd‰q¤ÜLüí4:ùÖ´¹4ĸ4ü¯4#„ô4Žd‰q
»ÔdŽdþ D…5¤,–5ü¯7AùÖ´û6Äú6üñ6#¼¶7Žd‰q
¼ÔdŽdþ DÎ7¤,ß7ü¶=DDÄ=‰qÁ®
½ÔdŽd$Í=Ó=ü BBùÖ´ìAÄëAüâA#\£BÅÏŽd‰q
¾ÔdŽdþ D¯BinitÁ$ÀB¤,ÑBü¡QOŒ¯Q呎d‰q
¿ÔdŽdµ ÁQþ DÎQ¤,ßQÜÙTàT©
 ©
‰qå‘ äT
ÀÔdŽd$åTü¦VD­Vª
 ª
‰q ¶V
ÁÔdŽd$·Vì¡XL¨X«
 «
‰q «
Žd ²X
ÂÔdŽd$³XüöX9tùX¬
 ¬
‰qÛ¼ݼÞ¼©ß¼à¼ÛἈcSñŸ«‡zÙ„¶ݳ ˆY
ÃÔdŽd$‰Yü¬c8ùÖ´øbÄ÷büîb#<³c­
 ­
‰q »c
ÄÔdŽd$ÀcÆc
additionalÁTÒcü‡g¬Šg®
 ®
‰q¥ÆÇÇÆ ÃgÈÕ  gæÑ £gŒL¦g
ÅÔdŽdslfÁ¾gâgêàTúg;=@Bü´k.ùÖ´€kÄÿjüöj#„»k¯
 ¯
‰q Ìk
ÈÔdŽd$Ñk×kü’m[\™m°
 °
‰qÖ¿Ù¿Ú¿«Û¿ˆÜ¿Ý¿Þ¿ˆ‚†f|Â
Ùn ¥m
ÉÔdŽd$ªm°mêàT¼mü·u>ùÖ´ƒuÄ‚uüùt#l¾u±
 ±
‰q Ìu
ÊÔdŽd$Ñu×uêàTãuü·w€Œ¾w²
 ²
‰qíä Ùw
ËÔdŽd$ÞwìwêàT€xü°|+ùÖ´ü{Äû{üò{#l·|³
 ³
‰q Å|
ÌÔdŽd$Ê|ËÐ|ü‘}"¥ÎÏÎÏÈÕ –}æÑ ™}ŒLœ}‰qÐÑÒÓÔ&(+-ü÷~>lú~´
 ´
‰qÍ ˆÍ
ÐÔdŽd$‰êàT›ü=|“€µ
 µ
‰që´Í £€Í
ÑÔdŽd$¨€µ ®€Ë€üœ‡ZtŸ‡
 
‰qíäÍ ®‡Í
ÒÔdŽd$³‡¹‡êàTŇüª‘VT­‘·
 ·
‰qíäÍ ¸‘Í
ÓÔdŽd$½‘ÑêàTÏ‘ü„—?ùִЖÄÏ–üÆ–#4‡—¸
 ¸
‰qíäÍ Ž—Í
ÔÔdŽd$“—Ë™—”œÔÄÃÕÝÃÕûÃÕÕÔÕÔdŽd’c»o ݳüûŸÉ\þŸ¹
Ö¿Ù¿Ú¿«Û¿ˆÜ¿Ý¿Þ¿ˆ‚†f|Â
ݳÃpöß ¹
ºfÖ¿Ù¿Ú¿«Û¿ˆÜ¿Ý¿Þ¿ˆ‚†f|Â
ë´Ùn×× ù ô¨ Š …©Lº¡
ÖºføµT’ –!t¿ ¤,ò 24¹¢ÖÄÃØÝÃØûÃØØÖغfÃp»o¦ÖÄÃÙÝÃÙûÃÙÙÖÙºf ïÙnªïü§+¥ÛÜÜÛÈÕ ”§æÑ —§ŒLš§‰qÝ"Ý%')+”­¨$°¨º
 º
‰qÚ µ¨Ú
ÝÔdŽd$º¨ü²ª6ùÖ´†ªÄ…ªüü©#tµªíä
Þ 4Ī„«ÞÄÃßÝÃßûÃßßÞßÙn»oüа@\°íä
à
alloc_sizeÁT™°Üå³ùִ˳ÄʳüÁ³#Œè³
áüJG A contiguous growable array type with heap-allocated contents, writtenÁlK
`Vec<T>`.ÁYúü]HE Vectors have *O*(1) indexing, amortized *O*(1) push (to the end) andÁô¦ *O*(1) pop (from the end).ÁÅúüÉDA Vectors ensure they never allocate more than `isize::MAX` bytes.ÁŽút’Ô¡úü¥:7 You can explicitly create a [`Vec`] with [`Vec::new`]:Áàú¾•üì! let v: Vec<i32> = Vec::new();Á¾•úüš&# ...or by using the [`vec!`] macro:ÁÁú¾•ìÍ let v: Vec<i32> = vec![];Áëúüï  let v = vec![1, 2, 3, 4, 5];Áúü”&# let v = vec![0; 10]; // ten zeroesÁ¾•ÃúüÇPM You can [`push`] values onto the end of a vector (which will grow the vectorÁ|˜ as needed):Á¨ú¾•Ü´ let mut v = vec![1, 2];ÁÐú v.push(3);Á¾•ëúüï.+ Popping values works in much the same way:Ážú¾•ܪþÆú´Ê let two = v.pop();Á¾•éúüíRO Vectors also support indexing (through the [`Index`] and [`IndexMut`] traits):ÁÀú¾•ôÌ let mut v = vec![1, 2, 3];Á¬ë let three = v[2];Á¤ v[1] = v[1] + 5;Á<¾•žú¼¢ [`push`]: Vec::pushÁ»¤ŒˆÌ‚¤ˆ«ýÑÖâÕÙÚþéâ㮿ßâäíðâå×­  `âæŽšeâ莠eâè¢eâéù$€
Œ5âê
ÃLâëâŸ
âìâŸâìí
ëâîš
 Àâï•Åd† ÃÛâð½Ê\” ÑÛâñ­
 âóBoundÁ,¸ ç£âôIndexÁ,¿ Ù¢âõIndexMutÁDÆ ³"âö RangeBoundsÁ\Ð ¤#â÷µ âù§ âúž$ ‰fâüÚT– “kâýè 1â¾L4î Äâ(¾LÅâ(ã  ¾âˆŽ
h⃥
¥âÎM|©
ÛâµO4ù
õè(,È»ªà-Dõü¿2dš×âáœòò´‹ ãÕÇʤ§Ä®
ÌÌ
|
Xñ
JM:=), ¬ 

õøÝàÃÆ ¸è ª­\‚ Ÿ  ”Î Š|RUT‡
GüÎ P;>,/¤ë
!ùÖ´ŒÄ‹ü‚#âõµ $ ˆŠž$) ‰fˆŒèLL 1ˆŽ¾L4W Ĉ(¾Lň(è(,m »ˆªöt âˆL 
\ Š,! ¤5 ~oq,e GI35ü±= 8»
š»
Éà  ÉÛ Ã ùM°r êÛ Àr–˜úMûMÿM˜CEHJ  °rúMü¥(  ¼
 ¼
ÀrÛ¼ݼÞ¼©ß¼à¼ÛἈcSñŸ«‡zÙÀrúM ­ 
8°räh ü‹-  ½
 ½
ÀrË£ ˜ 
˜8°räh$™ üãH 8¾
ššš¾
Éà è ÉÛ õ Ì êÛ ÀrœMœ*,/1üÈ-  ¿
 ¿
ÀrïŽ Õ 
œ8°räh ü F 8À
šžŸÀ
ŸžÉà ¥ ÉÛ ² Ì êÛ Àr!$&üë9 8Á
š¡¢Á
¡¢Éà ð ÉÛ ý Ì êÛL€ Àr£"£*,/1”¹ Â
 Â
Àr  Á  
£8°räh üð% üÂ- * Private helper methods for `Splice::drop`Á8Ã
¥¥¦Ã
¥¦¸Û õ ÉÛ ø êÛ ªs§©"$üçN  ˆÄ
Å
 Ä
ªs Å
š¤š¨¨  ¤Íìô– ö ùMô–”ù ô–úMÞhD‚
§8Þhähô–$ ãOd˜ IKü±1  ˆÆ
 Æ
ªs¤ Å ¤
©8Þhäh êà ”»æâ»×
 `«¬ÞÉlòP«­í$>뫯š<D À«°•ÅdMÃÛ«±µ $l«³§<r«´ž‰f«è1«¸¾L4¼Ä«¹(¾LÅ«¹(öÑ⫺LýÌíL2Þ8ÏѾÀL`°f¡£\€•,†¤šŠŒz|TÊRüÊ7ü×%" A draining iterator for `Vec<T>`.Áýúü/, This `struct` is created by [`Vec::drain`].Áü±# See its documentation for more.ÁÕú
# ExampleÁçú¾•ôó let mut v = vec![0, 1, 2];Áü’/, let iter: std::vec::Drain<_> = v.drain(..);Á¾•ø¼¥½¾¼½¾¸Û ßÉÛÔæÞhøâêÛähøõáž§eŽtÄ­KKtƒLÇ¿ÀÁÂèÛac¼i æ´b¼äªâ»»Ôãâ»»ü­#â»»ÄlÄlIterÁÇlµ ™lÈl
end_or_lenÁ™lÉl·J™lŒœjSžøÞhüÖ"áâ»»§ ïíe¼îËè¿*Éüý@8Ç
¥ÄÅÅÄÇ
¸Û ÉÛ ¿cÞhT…êÛL”ªsÆÀcÆ1368üÄ8ÇÈ
É
Ê
 È
ªs É
 c cˆ¢cµ
 `£c€. `àB¤GS
Ê
²¾Ã ËÃ
Æ8Þhäh± ÒüÍ)øÈ¥ÉÊÈÉÊ¸Û ÖÉÛ ÙêÛŽtËÌÍÒ&(+-ôƒ üý<9 Returns the remaining items of this iterator as a slice.Á¾úÔÙú¾•üí&# let mut vec = vec!['a', 'b', 'c'];Áü˜ " let mut drain = vec.drain(..);Áü¿ 30 assert_eq!(drain.as_slice(), &['a', 'b', 'c']);Áü÷ " let _ = drain.next().unwrap();Áüž
.+ assert_eq!(drain.as_slice(), &['b', 'c']);Á
¾•.\Ý
 Ë
 Ë
Žt Ë
ÝhÇ Ç
ËøÞhäh$” ì« üÌ 4ω.\…  Ì
 Ì
Žt Ì
ähÇ ¼ Ç
ÌøÞhäh ´–ü‡
0- Keep unyielded elements in the source `Vec`.Á¼
ú
Ô×
ú
¾•üë
 #![feature(drain_keep_rest)]Áúü˜&¥üÃ"Í¥êúüò+( assert_eq!(drain.next().unwrap(), 'a');Á¢úüª.+ // This call keeps 'b' and 'c' in the vec.Á´Ý drain.keep_rest();Áøúü€)& // If we wouldn't call `keep_rest()`,Áä® // `vec` would be empty.ÁüÏ  assert_eq!(vec, ['b', 'c']);Á¾•LŽtÇÇ
ÍøÞhähü™!8øÏ¥ÐÑÑÏÐ¸Û ¢!ÉÛ ¥!êÛL¨!ŽtÒâÒž!(*-/Äî!4ñ!Í
 Í
Žt Í
ÝhÎ ø!Î
ÒøÞhäh$ù!üª"B8Î
¥ÔÕÔÎ
Õ¸Û ¶"ÉÛ ¿" Þh$¹" äh$Â"êÛLÉ"ªs57:<üñ"B8Ï
¥×ØÏ
Ø×¸Û ý"ÉÛ †#ÌìÞh$€#Ììäh$‰#êÛL#ªs79<>ü¸#28Ð
¥ÚÛÐ
ÚÛ¸Û ½#ÉÛ À#êÛLÃ#ªsÜÝßúMûMÿMÝß469;Lñ#$ö#ÙÙÞhü›$$ž$Ñ
 Ñ
ªsÛ¼ݼÞ¼©ß¼à¼ÛἈcSñŸ«‡zÙÞhÙ £$Ù
Ý8Þhäh$¨$,ô$ÝÄÃÞÝÃÞûÃÞÞÝÞÞhäh ÞhÞhüÂ%-LÅ%Ò
 Ò
ªsË£Ù Ï%Ù
ß8Þhäh$Ð%ü™&=8Ó
¥áâáâÓ
¸Û ž&ÉÛ ¡&êÛL¤&ªsãMã"$')üó&$Lö&Ô
 Ô
ªs±´à €'à
ã8Þhäh$…',Ö'ãÄÃäÝÃäûÃääãäÞhäh‚¶üŒ(.8Õ
¥æççÕ
æ¸Û ‘(ÉÛ ”(êÛL—(ªsè"è"$')”Ï($Ò(Ö
 Ö
ªså ×(å
è8Þhäh$Ü(¿RLÃ)«ø+ëøì¥íîëíîìÍìçu Õ)Íìíu Ø)1íuLÛ)øø+¼æ)çuø+íuø+çuø·íuøÌ©u·pר`Ùëêï ø+»»è(¿)âÀŸ)âÁùâÂÁâÄ­KKtƒLÇøçuíu©uõ¿RI«í¼©uéé
êø+øçuíuÍ)Ñ)LOKN;>«ééí¼ü‰*>ø+ñøò¥óôôòñóß» –*ï» ™*ÿ»Lœ*©uõ"õŽ**.035”Ö*$Ù*×
 ×
©uð Þ*ð
õø+øçuíu$ã*üœ?;8Ø
¥÷ø÷Ø
ø¸Û ¡?ÉÛ ¤?êÛL§?ªsüÜ?78Ù
¥úûûÙ
ú¸Û á?ÉÛ ä?êÛLç?ªsÌä©l€L„â×
 `ýþÞÉlòPýÿâŸ\@ýâŸýí$]ëýš<c Àýƒ•ÅdlÃÛýµ ý§<’ýž‰fýL$É ¿ýŠè1ýŒ¾L4çÄý(¾LÅý(¥¥ýŽö¨âýLdÌUÌ2FLQ"WL€úëí\ Þ,¦œºÓ,ÔÄÆ°²|~T¡küÐ-ü®+( An iterator that moves out of a vector.ÁÚúüÞMJ This `struct` is created by the `into_iter` method on [`Vec`](super::Vec)Áü¬-* (provided by the [`IntoIterator`] trait).ÁÚúœìú¾•Ôø let v = vec![0, 1, 2];Áü“41 let iter: std::vec::IntoIter<_> = v.into_iter();Á¾•¥ÈÕ äæÑ¬çŒŽvš¿ÖN3˜Æ:<? ç´bÔ„ââšü¤"âÔ ¬Ì×âüü!,‡âÃÛÃÛ•ÅÅÛ»¬µÜÀ,%*ŽdÄ£®â–¤ÄÁÌâ–¤üÞ?¥ššÈÕ ãæÑ ò›˜ŒŽvœÀcœ*,/1ü¤8§Ú
Û
Ü
 Ú
Žv Û
 c cˆ¢cµ
 `£c€. `àB¤GS
Ü
²¾ «
œÔdŽd± ²ü« $¥žŸŸžÈÕ ° æÑ ³ ŒŽv ¡¢£#%(*ôÄ üÖ <¥¤
ú
Ô²
ú
¾•üÆ
" let vec = vec!['a', 'b', 'c'];Áüí
(% let mut into_iter = vec.into_iter();Áüš 74 assert_eq!(into_iter.as_slice(), &['a', 'b', 'c']);ÁüÖ &# let _ = into_iter.next().unwrap();Áü 2/ assert_eq!(into_iter.as_slice(), &['b', 'c']);Á<¸ ¾• Ý
 Ý
Žv Ý
óe Ô 
 ÔdŽd üŠ*ü¯
DA Returns the remaining items of this iterator as a mutable slice.Áø
út€Ôú<¾•ü§"ßÎüÎ(‹Ïüû7½Ïü·&# into_iter.as_mut_slice()[2] = 'z';Áüâ/, assert_eq!(into_iter.next().unwrap(), 'a');Áü–/, assert_eq!(into_iter.next().unwrap(), 'b');ÁüÊ/, assert_eq!(into_iter.next().unwrap(), 'z');Á¾•dÞ
 Þ
Žv Þ
óe ž
¡ÔdŽdìÂüó4ωß
 ß
Žv ß
Žd Ó
¢ÔdŽdü*„„ýà
 à
Žv óe 
£ÔdŽdüý3¥¥¦¦¥ÈÕ æÑ ŒŽv§â§"$')Ä·á
 á
Žv á
óe¤ Á¤
§ÔdŽdüóA¥©ªª©ÈÕ ÿæÑ ˆôÓ$‚ŒL‹„Ô$—Žv'),.ü¹A¥¬­¬­ÈÕ ÅæÑ ÎòԌՎv'),.üÿ1¥¯°¯°ÈÕ æÑ ŒŽv±²³´úMûMÿM€N²³´?ADF®®Ôdüáâ
 â
Žv¦ª® é®
²ÔdŽdüÕ-ã
 ã
ŽvË£® â®
³ÔdŽd¼ƒ,†Žv®®
´ÔdŽdü¹<¥··ÈÕ ¾æÑ ÁŒŽv¸M¸"$')ü’$L•ä
 ä
Žv¦ªµ Ÿµ
¸ÔdŽdüó":¥º»»ºÈÕ ø"æÑ û"ŒLþ"Žvü²#6¥½¾¾½ÈÕ ·#æÑ º#ŒL½#Žvü‘$=ùÖ´÷#Äö#üí##¥ÀÁÁÀÈÕ –$æÑ  $åª,™$ŒL£$þª,¯$ŽvÂÙÂ2479¼Õ$,Ø$å
 å
ŽvŽv¿ Þ$¿
ÂÔdŽd$ß$ü&-¥ÄÅÄÅÈÕ ¢&æÑ ¥&ŒL¨&ŽvÆ"Æ"$')”Ñ&$Ô&æ
 æ
Žvà Ù&Ã
ÆÔdŽd$Þ&©SLõ&ýøÉ¥ÊËÉÊË¸Û ƒ'ÉÛ †'êÛL‰'áž´”'÷žÇÇÈâ+̈ý L ö!IøÞhähL ö!IÈÌ øŸ©•æÐ©SÒýîæ•æÇÇ
ÈøÞhähÿ&ÞàãåàâýÇÇîæü¶'28ç
¥ÎÏç
ÏÎ¸Û »'ÉÛ ¾'êÛLÁ'ãwÐ"Ð"$')”÷'$ú'è
 è
ãwÍ ÿ'Í
Ð8Þhäh$„(tT”âo=
»ÑÒèL]
1ÑÓöt
âÑÔÄ(
;üG
-Tm
ìz
„‡
 ˜
Ê
 ž
Ý

 Ÿ
¬
,  
 ¡
ª
, ¢
8varsÁ
& §
8¯¨

«
, ®
8¯
& ²
8´³
$ µ
, ·
8rhsÁ¸
& »
8´¼
, ¿
 À
Û

8$
, Ç
8´È
& Ê
8´Ë
& Í
, Ï
8boundÁ
& Õ
8¼
- Ü
*ß
 â
È
8
 ð
8¥ ñ
$ ò
8¦ ô
$ õ
, ÷
 ø
þ
, ù
8þé

ÿ
 
8²L
 
, Œ
8Øê
 
8

, 
8
8$
8¥ µ
& 
8²L¸
 Á
8¦ Â
 Ã
$ Ä
, Ò
 Ó
ß
, Ô
8´Õ
& ×
, Ù
8Èë
- à
 ê
Â
+ ø
 ù
ˆ
8Ý
 

8±4
8 
8
 
¯
 œ
8$
$ ¡
8¹

& ¨
 ª
, «
8Øê¬
(±
8º$´
 ¹
Ñ
8
 ¿
Â
!À
Ä
8¹

 Ì
Ï
!Í
+ ß
 à
ï
8Ý
 ç
î
8±
8 ý
8Ø 
 

 ƒ
8$„
$ ˆ
8¹

& 
 
, 
8Øê
(˜
8º$
  
¸
8
 ¦
©
!§
«
8¹

 ³

!´
œÅùÖ´«Īü¡#â×ü¬"âøØØ×׿2ÙÖÚã2Ö‚û_Ö
g;ø‚û_Ö
g;ÙÚàË”ÕÕÖ×× ø„íÖ××Ì‚øÜÜ™ôÝÞü¸-Æâ“õ™ôÛÛ
ÝøÊüØ8âé
 é
™ôÛ ôÛ
Þø incrementÁLÿôÁ8ê
ê
­"à”ü$ÿë
 ë
­}ß ß
à8$‰üƒ#q7üÛ^(ü©NK A contiguous growable array type, written as `Vec<T>`, short for 'vector'.ÁøúÔú<¾•ì— let mut vec = Vec::new();Á„µ
vec.push(1);Á„Æ
vec.push(2);Á×úìÛ assert_eq!(vec.len(), 2);ÁÔù assert_eq!(vec[0], 1);Áúü˜# assert_eq!(vec.pop(), Some(2));Áì¼ assert_eq!(vec.len(), 1);ÁÚú vec[0] = 7;ÁÔî assert_eq!(vec[0], 7);Áúü*' vec.extend([1, 2, 3].iter().copied());Á¸úœ¼ for x in &vec {ÁÄÐ println!("{x}");ÁÆ™üï" assert_eq!(vec, [7, 1, 2, 3]);Á<¾•šúüžA> The [`vec!`] macro is provided for convenient initialization:Áàú¾•üì! let mut vec1 = vec![1, 2, 3];ÁŒŽ vec1.push(4);Áü '$ let vec2 = Vec::from([1, 2, 3, 4]);ÁÜÈ assert_eq!(vec1, vec2);Á¾•ìúüðIF It can also initialize each element of a `Vec<T>` with a given value.ÁüºLI This may be more efficient than performing allocation and initializationÁü‡FC in separate steps, especially when initializing a vector of zeros:ÁÎú¾•ÌÚ let vec = vec![0; 5];Áüô%" assert_eq!(vec, [0, 0, 0, 0, 0]);Ášúüž;8 // The following is equivalent, but potentially slower:ÁüÚ(% let mut vec = Vec::with_capacity(5);Á¬ƒ vec.resize(5, 0);Áü™%¹<¿¾•ÇúìË For more information, seeÁüé<9 [Capacity and Reallocation](#capacity-and-reallocation).Á¦úüª)& Use a `Vec<T>` as an efficient stack:ÁÔú¾•üà let mut stack = Vec::new();Áú”„ stack.push(1);Á”— stack.push(2);Á”ª stack.push(3);Á½úüÁ'$ while let Some(top) = stack.pop() {ÁÌé // Prints 3, 2, 1ÁÔƒ println!("{top}");ÁÆ™¾•¬ú # IndexingÁ¿úüÃNK The `Vec` type allows to access values by index, because it implements theÁü’63 [`Index`] trait. An example will be more explicit:ÁÉú¾•ìÕ let v = vec![0, 2, 4, 6];Áüó0- println!("{}", v[1]); // it will display '2'Á¾•¬úü°OL However be careful: if you try to access an index which isn't in the `Vec`,Áü€1. your software will panic! You cannot do this:Á²úœ¶ ```should_panicÁìÊõˆüè+( println!("{}", v[6]); // it will panic!Á<” ¾•œ úü  LI Use [`get`] and [`get_mut`] if you want to check whether the index is inÁ the `Vec`.Áü úl€!
# SlicingÁŽ!úü’!LI A `Vec` can be mutable. On the other hand, slices are read-only objects.Áüß!52 To get a [slice][prim@slice], use [`&`]. Example:Á•"ú<™"¾•ü¡"$! fn read_slice(slice: &[usize]) {ÁtÆ" // ...Á,Õ"Æ™Û"ú¼ß" let v = vec![0, 1];Áœ÷" read_slice(&v);Á#úÔ# // ... and that's all!Áüª#$! // you can also do it like this:ÁÌÏ# let u: &[usize] = &v;Á¤é# // or like this:Á¬þ# let u: &[_] = &v;Á<”$¾•œ$úü $MJ In Rust, it's more common to pass slices as arguments rather than vectorsÁüî$OL when you just want to provide read access. The same goes for [`String`] andÁl¾%
[`&str`].ÁÌ%úüÐ% # Capacity and reallocationÁð%úüô%LI The capacity of a vector is the amount of space allocated for any futureÁüÁ&PM elements that will be added onto the vector. This is not to be confused withÁü’'KH the *length* of a vector, which specifies the number of actual elementsÁüÞ'NK within the vector. If a vector's length exceeds its capacity, its capacityÁü­(EB will automatically be increased, but its elements will have to beÁ„ó(
reallocated.Á„)úüˆ)PM For example, a vector with capacity 10 and length 0 would be an empty vectorÁüÙ)JG with space for 10 more elements. Pushing 10 or fewer elements onto theÁü¤*PM vector will not change its capacity or cause reallocation to occur. However,Áüõ*PM if the vector's length is increased to 11, it will have to reallocate, whichÁüÆ+QN can be slow. For this reason, it is recommended to use [`Vec::with_capacity`]Áü˜,GD whenever possible to specify how big the vector is expected to get.Áà,ú„ä,
# GuaranteesÁõ,úüù,MJ Due to its incredibly fundamental nature, `Vec` makes a lot of guaranteesÁüÇ-KH about its design. This ensures that it's as low-overhead as possible inÁü“.HE the general case, and can be correctly manipulated in primitive waysÁüÜ.PM by unsafe code. Note that these guarantees refer to an unqualified `Vec<T>`.Áü­/QN If additional type parameters are added (e.g., to support custom allocators),Áüÿ/63 overriding their defaults may change the behavior.Á¶0úüº0QN Most fundamentally, `Vec` is and always will be a (pointer, capacity, length)ÁüŒ1FC triplet. No more, no less. The order of these fields is completelyÁüÓ1LI unspecified, and you should use the appropriate methods to modify these.Áü 2KH The pointer will never be null, so this type is null-pointer-optimized.Áì2úüð2UR However, the pointer might not actually point to allocated memory. In particular,ÁüÆ3RO if you construct a `Vec` with capacity 0 via [`Vec::new`], [`vec![]`][`vec!`],Áü™4TQ [`Vec::with_capacity(0)`][`Vec::with_capacity`], or by calling [`shrink_to_fit`]Áüî4TQ on an empty Vec, it will not allocate memory. Similarly, if you store zero-sizedÁüÃ5VS types inside a `Vec`, it will not allocate space for them. *Note that in this caseÁüš6TQ the `Vec` might not report a [`capacity`] of 0*. `Vec` will allocate if and onlyÁüï6_\ if <code>[mem::size_of::\<T>]\() * [capacity]\() > 0</code>. In general, `Vec`'s allocationÁüÏ7NK details are very subtle --- if you intend to allocate memory using a `Vec`Áüž8RO and use it for something else (either to pass to unsafe code, or to build yourÁüñ8MJ own memory-backed collection), be sure to deallocate this memory by usingÁü¿9?< `from_raw_parts` to recover the `Vec` and then dropping it.Áÿ9úüƒ:RO If a `Vec` *has* allocated memory, then the memory it points to is on the heapÁüÖ:OL (as defined by the allocator Rust is configured to use by default), and itsÁü¦;MJ pointer points to [`len`] initialized, contiguous elements in order (whatÁüô;\Y you would see if you coerced it to a slice), followed by <code>[capacity] - [len]</code>ÁüÑ<1. logically uninitialized, contiguous elements.Áƒ=úü‡=KH A vector containing the elements `'a'` and `'b'` with capacity 4 can beÁüÓ=HE visualized as below. The top part is the `Vec` struct, it contains aÁüœ>KH pointer to the head of the allocation in the heap, length and capacity.Áüè>MJ The bottom part is the allocation on the heap, a contiguous memory block.Á¶?ú\º? ```textÁüÆ?&# ptr len capacityÁüí?'$ +--------+--------+--------+Áü•@'$ | 0x0123 | 2 | 4 |Áü½@'ޱŒå@Œ÷@ü‰A0- Heap +--------+--------+--------+--------+ÁüºA0
function.Ášˆúü¢ˆ+ÖÐüÒˆ30 [`dealloc`]: crate::alloc::GlobalAlloc::deallocÁЉút’‰Ô¥‰ú<­‰¾•Œ¹‰†üŒÏ‰ use std::mem;Áå‰úÔí‰ let v = vec![1, 2, 3];ÁŒŠúüÓŠEB // Prevent running `v`'s destructor so we are in complete controlÁÌ // of the allocation.Áü»‹*' let mut v = mem::ManuallyDrop::new(v);Áê‹úüò‹EB // Pull out the various important pieces of information about `v`ÁܼŒ let p = v.as_mut_ptr();Á´ÜŒ let len = v.len();ÁÜ÷Œ let cap = v.capacity();Áú©áü°(% // Overwrite memory with 4, 5, 6ÁÌÝ for i in 0..len {Áüû(% ptr::write(p.add(i), 4 + i);ÁL¨Žý ¶Žúü¾Ž2/ // Put everything back together into a VecÁüõŽ74 let rebuilt = Vec::from_raw_parts(p, len, cap);Áü±'$ assert_eq!(rebuilt, [4, 5, 6]);ÁÆ™¾•óúüû.+ Using memory that was allocated elsewhere:Á®ú×Óôƈééúüñ<9 use std::alloc::{AllocError, Allocator, Global, Layout};Á²‘ú|º‘ fn main() {ÁüΑOL let layout = Layout::array::<u32>(16).expect("overflow cannot happen");Á¢’úÔª’ let vec = unsafe {ÁüÉ’52 let mem = match Global.allocate(layout) {Áüƒ“63 Ok(mem) => mem.cast::<u32>().as_ptr(),Áü¾“*' Err(AllocError) => return,Átí“ };Á€”úüˆ”! mem.write(1_000_000);Á®”úü¶”63 Vec::from_raw_parts_in(mem, 1, 16, Global)ÁTñ” };Á€•úüˆ•&# assert_eq!(vec, &[1_000_000]);Áü³•'$ assert_eq!(vec.capacity(), 16);Á,ߕƙ<镾•t™–å‘ï€çç
ëÔdµ ¨–lengthÁ4µ–þ DÄ–ü²—¥íîíîÈÕ ·—æÑ º—ŒL½—ïïðñòóôõö÷øùúûüýþÿƒŒ¡¥³´µ·¸º»¼½¿ÁÃÄŘšœžü¥š%üØ—(% Constructs a new, empty `Vec<T, A>`.Á…˜úü˜C©×Õ˜útݘÔð˜ú<ø˜¾•Ü„™°õ¤™úÔ¬™ # #[allow(unused_mut)]ÁüË™30 let mut vec: Vec<i32, _> = Vec::new_in(System);Á<ƒš¾•4²šŽdïìì
ïÔdŽd¤«Nüå«:ü¬›LI Constructs a new, empty `Vec<T, A>` with at least the specified capacityÁüý›  with the provided allocator.Á¢œúüªœH¯Úü÷œKÛüÇAÖÛžúü•žE­ÜüßžKüÜü¯ŸEÑÝüùŸ" Þ  úü¨ GØÞüô :©ß³¡úü»¡OL For `Vec<T, A>` where `T` is a zero-sized type, there will be no allocationÁü¢1ÏàÅ¢úüÍ¢;–áü£®Ò±£úd¹£ôáÊ£úüÒ£:–⑤út™¤Ô¬¤ú<´¤¾•ÜÀ¤°õà¤úüè¤41 let mut vec = Vec::with_capacity_in(10, System);Á¡¥úü©¥IËãì÷¥äü™¦# assert_eq!(vec.capacity(), 10);ÁÁ¦úüɦ1üä¤ÿ¦¶å¤˜§Óå,±§Æ™ô»§ýåüÞ§#¤™†¨úüލ1¿æŒÄ¨ùæôÚ¨“çüý¨"»ç¤©úü¬©Hóçôù©ÄèüœªDA let vec_units = Vec::<(), System>::with_capacity_in(10, System);Áüåª1§é<›«¾•ùÖ´±«İ«ü§«#„쫎dïìì
ðÔdŽdþ Dý«¤,ެüÎ^ü•­HE Creates a `Vec<T, A>` directly from a pointer, a capacity, a length,Á¬â­ and an allocator.Áü­úd„®çÑ•®úü®FÌëdè®›ìù®úü¯L½ìüÒ¯Q“íü¨°Rîíüÿ°6Êîüº±RŠïü‘²Pæïüæ²IÀðü´³<“ñüõ³PÙñüÊ
Ìúü•Ì!¢Œ»ÌúüÃÌ+( Vec::from_raw_parts(mem, 1, 16)ÁTóÌ‚ÍúüŠÍ&½üµÍ'î,áÍÆ™<ë;•Œ›Î呎dïìì
ñÔdŽdµ ­ÎúŽ4ºÎþ DÉΤ,ÚÎüéÙ5ü—Ð2/ Decomposes a `Vec<T>` into its raw components.ÁÎÐúüÖÐA> Returns the raw pointer to the underlying data, the length ofÁüœÑ?< the vector (in elements), and the allocated capacity of theÁüàÑ@= data (in elements). These are the same arguments in the sameÁü¥Ò1. order as the arguments to [`from_raw_parts`].ÁÛÒúüãÒBîòüªÓ>; memory previously managed by the `Vec`. The only way to doÁüíÓA> this is to convert the raw pointer, length, and capacity backÁü³Ô?< into a `Vec` with the [`from_raw_parts`] function, allowingÁü÷Ô*' the destructor to perform the cleanup.Á¦Õúü®Õ+( [`from_raw_parts`]: Vec::from_raw_partsÁÞÕútæÕÔùÕú<Ö¾•üÖ# #![feature(vec_into_raw_parts)]ÁüµÖ%" let v: Vec<i32> = vec![-1, 0, 1];ÁßÖúüçÖ-* let (ptr, len, cap) = v.into_raw_parts();Á™×úÔ¡× let rebuilt = unsafe {ÁüÀ×=: // We can now make changes to the components, such asÁü‚Ø<9 // transmuting the raw pointer to a compatible type.ÁüÃØ" let ptr = ptr as *mut u32;ÁêØúüòØ*' Vec::from_raw_parts(ptr, len, cap)Á4¡Ù‚Ûü¬Ù,) assert_eq!(rebuilt, [4294967295, 0, 1]);Á<ÝÙ¾•tðÙïå‘ìì
òÔdŽd$ÿÙüðæCüÛ2Ó¯ÄÛúüÌÛ[X Returns the raw pointer to the underlying data, the length of the vector (in elements),Áü¬Ü[X the allocated capacity of the data (in elements), and the allocator. These are the sameÁüŒÝJG arguments in the same order as the arguments to [`from_raw_parts_in`].ÁÛÝúüãÝBîòüªÞ>Ö²üíÞAŸ³ü³ßB? into a `Vec` with the [`from_raw_parts_in`] function, allowingÁüúß*µ´©àúü±à1. [`from_raw_parts_in`]: Vec::from_raw_parts_inÁçàútïàÔ‚áú<Šá¾•ü–á2/ #![feature(allocator_api, vec_into_raw_parts)]ÁÍáúÜÕá°õõáúüýá63 let mut v: Vec<i32, System> = Vec::new_in(System);Á|¸â v.push(-1);ÁtÌâ v.push(0);Átßâ¿§òâúüúâ?< let (ptr, len, cap, alloc) = v.into_raw_parts_with_alloc();Á¾ãúÔÆã’·üåã=··ü§ä<ÿ·üèä"Ƹåúü—å41 Vec::from_raw_parts_in(ptr, len, cap, alloc)Á4Ðå‚ÛüÛå,ù<Œæ¾•Ì÷æï呎dìì
óÔdŽd$‘çüØëü²éDA Returns the total number of elements the vector can hold withoutÁŒûé reallocating.Á‘êút™êÔ¬êú<´ê¾•üÀê30 let mut vec: Vec<i32> = Vec::with_capacity(10);ÁŒøê vec.push(42);ÁüŽë#¤™<¶ë¾•Dßëì
 ì
ïì èëì
ôÔdŽd$éëüÄñ,ü¡ìLI Reserves capacity for at least `additional` more elements to be insertedÁüòìC@ in the given `Vec<T>`. The collection may reserve more space toÁüºíHE speculatively avoid frequent reallocations. After calling `reserve`,Áü‡îHE capacity will be greater than or equal to `self.len() + additional`.ÁüÔî30 Does nothing if capacity is already sufficient.ÁŒïúd”ïôá¥ïúü­ï:–âìïútôïÔ‡ðú<ð¾•Ô›ð let mut vec = vec![1];Á¤ºð vec.reserve(10);ÁüÓð"»ç<úð¾•ùÖ´ñÄñü†ñ#<Ëñí
 í
ïì Óñì
õÔdŽd$ØñêàTÞñü›ú2ü®òLI Reserves the minimum capacity for at least `additional` more elements toÁüÿòHE be inserted in the given `Vec<T>`. Unlike [`reserve`], this will notÁüÌóKH deliberately over-allocate to speculatively avoid frequent allocations.ÁüœôLI After calling `reserve_exact`, capacity will be greater than or equal toÁüíôFC `self.len() + additional`. Does nothing if the capacity is alreadyÁ|¸õ sufficient.ÁÌõúüÔõFC Note that the allocator may give the collection more space than itÁüŸöHE requests. Therefore, capacity can not be relied upon to be preciselyÁüìöB? minimal. Prefer [`reserve`] if future insertions are expected.Á³÷úì»÷÷ÓÝ÷údå÷ôáö÷úüþ÷:–â½øútÅøÔØøú<àø¾•ÔìøåÊÔ‹ù vec.reserve_exact(10);Áüªù"»ç<Ñù¾•ùÖ´çùÄæùüÝù#l¢úî
 î
ïì °úì
öÔdŽd$µúêàT»úü²…Oü‘ûTQ Tries to reserve capacity for at least `additional` more elements to be insertedÁüêûWT in the given `Vec<T>`. The collection may reserve more space to speculatively avoidÁüÆüIF frequent reallocations. After calling `try_reserve`, capacity will beÁü”ýDA greater than or equal to `self.len() + additional` if it returnsÁüÝýIF `Ok(())`. Does nothing if capacity is already sufficient. This methodÁü«þ30 preserves the contents even if an error occurs.ÁãþúdëþËÚüþúü„ÿPM If the capacity overflows, or the allocator reports a failure, then an errorÁ„Ùÿ
is returned.ÁîÿútöÿÔ‰€ú<‘€¾•ü52 use allocator_api2::collections::TryReserveError;Á×€úü߀HE fn process_data(data: &[u32]) -> Result<Vec<u32>, TryReserveError> {Áü¬$! let mut output = Vec::new();ÁÕúüÝ63 // Pre-reserve the memory, exiting if we can'tÁü˜‚(% output.try_reserve(data.len())?;ÁÅ‚úüÍ‚GD // Now we know this can't OOM in the middle of our complex workÁü™ƒ.+ output.extend(data.iter().map(|&val| {Áü̃+( val * 2 + 5 // very complicatedÁdüƒ }));Áú”•„ Ok(output)Á,¬„Æ™ü¶„UR # process_data(&[1, 2, 3]).expect("why is the test harness OOMing on 12 bytes?");Á<¾•\¹…ï
 ï
ïíäì Å…ì
÷ÔdŽd$Ê…êàTÐ…üô’Uü†C@ Tries to reserve the minimum capacity for at least `additional`ÁüЇJG elements to be inserted in the given `Vec<T>`. Unlike [`try_reserve`],ÁüÙ‡LI this will not deliberately over-allocate to speculatively avoid frequentÁüªˆLI allocations. After calling `try_reserve_exact`, capacity will be greaterÁüûˆFC than or equal to `self.len() + additional` if it returns `Ok(())`.ÁüƉ74 Does nothing if the capacity is already sufficient.Á‚ŠúüŠŠF˜ÐüÕŠHéÐü¢‹FC minimal. Prefer [`try_reserve`] if future insertions are expected.Áí‹úüõ‹%" [`try_reserve`]: Vec::try_reserveÁŸŒúd§ŒËÚ¸ŒúüÀŒPƒÙ„•ÝÙªúÔÅú¾•üÙ5®Ú“Žúü›ŽHûÚüèŽ$ÎÛúü™6ŠÜüÔ.+ output.try_reserve_exact(data.len())?;ÁúüG‹ÝüÛ.ÝÝüŽ‘+–Þd¾‘ËÞÏ‘ú”בîÞ,î‘Æ™üø‘U™ß<Ò’¾•Œû’ð
 ð
ïíäì ì
øÔdŽd$’“êàT˜“ü©˜ü;8 Shrinks the capacity of the vector as much as possible.ÁДúüØ”JG It will drop down as close as possible to the length but the allocatorÁü§•LI may still inform the vector that there is space for a few more elements.Áø•út€–Ô“–ú<›–¾•ü§–)ŒãÔÕ– vec.extend([1, 2, 3]);Áüô–#¤™Äœ— vec.shrink_to_fit();Áü¹—! assert!(vec.capacity() >= 3);Á<ß—¾•ùÖ´õ—Äô—üë—#l°˜ñ
 ñ
ïì ¾˜ì
ùÔdŽd$ØüŠ 0ü˜›:7 Shrinks the capacity of the vector with a lower bound.Á×›úüß›A> The capacity will remain at least as large as both the lengthÁÜ¥œ and the supplied value.ÁÅœúüÍœJG If the current capacity is less than the lower limit, this is a no-op.ÁœúÔ·ú<¿¾•üË)ŒãÔù×ìü˜ž#¤™¬Àž vec.shrink_to(4);ÁüÚž! assert!(vec.capacity() >= 4);Á¬€Ÿ vec.shrink_to(0);ÁüšŸ!­í<ÀŸ¾•ùÖ´ÖŸÄÕŸüÌŸ#L‘ ò
 ò
ïì › ì
úÔdŽd$   min_capacityÁd¦ ü¬§0üÄ¡74 Converts the vector into [`Box<[T]>`][owned slice].Á€¢úüˆ¢EB If the vector has excess capacity, its items will be moved into aÁüÒ¢;8 newly-allocated buffer with exactly the right capacity.Á’£ú´š£ÒÔµ£út½£ÔУú<Ø£¾•Ô䣦ƒ¤úü‹¤%" let slice = v.into_boxed_slice();Á<µ¤¾•Á¤úüɤ# Any excess capacity is removed:Áñ¤ú<ù¤¾•ü…¥)ŒãÔ³¥×ìÒ¥úüÚ¥#¤™ü‚¦'$ let slice = vec.into_boxed_slice();Áü®¦/, assert_eq!(slice.into_vec().capacity(), 3);Á<⦾•ùÖ´ø¦Ä÷¦üî¦#„³§ï¼eìì
ûÔdŽd$ȧü–³&üë©FC Shortens the vector, keeping the first `len` elements and droppingÁl¶ª
the rest.ÁȪúüЪEB If `len` is greater than the vector's current length, this has noÁ\š« effect.Áª«úü²«FC The [`drain`] method can emulate `truncate`, but causes the excessÁüý«/, elements to be returned instead of dropped.Á±¬úü¹¬A> Note that this method has no effect on the allocated capacityÁ”ÿ¬ of the vector.Á­útž­Ô±­úü¹­52 Truncating a five element vector to two elements:Áó­ú<û­¾•ü‡®&# let mut vec = vec![1, 2, 3, 4, 5];Á¤²® vec.truncate(2);ÁäË® assert_eq!(vec, [1, 2]);Á<쮾•ø®úü€¯HE No truncation occurs when `len` is greater than the vector's currentÁ\ͯ length:Áݯú<対•üñ¯  let mut vec = vec![1, 2, 3];Á¤–° vec.truncate(8);Áü¯° assert_eq!(vec, [1, 2, 3]);Á<Ó°¾•ß°úüç°EB Truncating when `len == 0` is equivalent to calling the [`clear`]Á\±± method.ÁÁ±ú<ɱ¾•üÕ± ø€ ¤ú± vec.truncate(0);ÁÄ“² assert_eq!(vec, []);Á<°²¾•¼²úÌIJ [`clear`]: Vec::clearÁÌâ² [`drain`]: Vec::drainÁD³ó
 ó
ïì ¦³ì
üÔdŽd$«³±³ô”½üàº2/ Extracts a slice containing the entire vector.Á—»úÜŸ» Equivalent to `&s[..]`.Á¿»útÇ»ÔÚ»ú<⻾•üî» use std::io::{self, Write};Áü’¼%" let buffer = vec![1, 2, 3, 5, 8];Áü¼¼1. io::sink().write(buffer.as_slice()).unwrap();Á<ò¼¾•D›½ô
 ô
ï ô
óeì ¤½ì
ýÔdŽd$¥½üÀ*üͽ2/ Extracts a mutable slice of the entire vector.Á„¾úüŒ¾ Equivalent to `&mut s[..]`.Á°¾út¸¾Ô˾ú<Ó¾¾•ôß¾ use std::io::{self, Read};Áü‚¿  let mut buffer = vec![0; 3];Áü§¿A> io::repeat(0b101).read_exact(buffer.as_mut_slice()).unwrap();Á<í¿¾•d–Àõ
 õ
ï õ
óeì £Àì
þÔdŽd$¨ÀüãÈ üÔÀKH Returns a raw pointer to the vector's buffer, or a dangling raw pointerÁü¤Á=: valid for zero sized reads if the vector didn't allocate.ÁæÁúüîÁDA The caller must ensure that the vector outlives the pointer thisÁü·ÂA> function returns, or else it will end up pointing to garbage.ÁüýÂ@= Modifying the vector may cause its buffer to be reallocated,ÁüÂÃ52 which would also make any pointers to it invalid.ÁüÃúü„ÄXU The caller must also ensure that the memory the pointer (non-transitively) points toÁüáÄYV is never written to (except inside an `UnsafeCell`) using this pointer or any pointerÁü¿ÅYV derived from it. If you need to mutate the contents of the slice, use [`as_mut_ptr`].ÁÆút¥ÆÔ¸Æú<Àƾ•ÔÌÆ let x = vec![1, 2, 4];ÁÜëÆ let x_ptr = x.as_ptr();Á‹Çúd“Ç©áì¤Ç for i in 0..x.len() {ÁüÆÇ.+ assert_eq!(*x_ptr.add(i), 1 << i);ÁLùÇý ,‡ÈÆ™<‘Ⱦ•Èúü¥È# [`as_mut_ptr`]: Vec::as_mut_ptrÁ4êÈö
 ö
ï–¤ì ñÈì
ÿÔdŽd$òÈü½Ò&ü‰ËKH Returns an unsafe mutable pointer to the vector's buffer, or a danglingÁüÙËIF raw pointer valid for zero sized reads if the vector didn't allocate.Á§Ìúü¯ÌD¼ üøÌA‹Ž ü¾Í@׎ üƒÎ5¢ ½ÎútÅÎÔØÎú<àξ•üìÎ1. // Allocate vector big enough for 4 elements.ÁŒ¢Ï let size = 4;Áü¸Ï30 let mut x: Vec<i32> = Vec::with_capacity(size);ÁüðÏ let x_ptr = x.as_mut_ptr();Á”ÐúüœÐC@ // Initialize elements via raw pointer writes, then set length.ÁdäЩáÔõÐ for i in 0..size {Áü”Ñ%" *x_ptr.add(i) = i as i32;ÁL¾Ñý ÄÌÑ x.set_len(size);Á,éÑÆ™üóÑ# assert_eq!(&*x, &[0, 1, 2, 3]);Á<›Ò¾•TÄÒ÷
 ÷
ïå‘ì ÏÒì
ÔdŽd$ÔÒì¼ÕüíÔ4ωLÃÕø
 ø
ï ø
Ždì ÍÕì
ÔdŽd$ÎÕüÆí0ü„Ö1. Forces the length of the vector to `new_len`.ÁºÖúüÂÖC@ This is a low-level operation that maintains none of the normalÁüŠ×DA invariants of the type. Normally changing the length of a vectorÁüÓ×=: is done using one of the safe operations instead, such asÁü•Ø74 [`truncate`], [`resize`], [`extend`], or [`clear`].ÁÑØúüÙØ [`truncate`]: Vec::truncateÁÜýØ [`resize`]: Vec::resizeÁôÙ [`extend`]: Extend::extendÁÌÀÙïƒ ÞÙúdæÙçÑ÷ÙúüÿÙ=: - `new_len` must be less than or equal to [`capacity()`].ÁüÁÚ=: - The elements at `old_len..new_len` must be initialized.ÁƒÛúü‹Û! [`capacity()`]: Vec::capacityÁ±Ûút¹ÛÔÌÛúüÔÛ@= This method can be useful for situations in which the vectorÁü™ÜA> is serving as a buffer for other code, particularly over FFI:ÁßÜúlçÜ
```no_runÁÔùÜ # #![allow(dead_code)]Áü˜Ý=: # // This is just a minimal skeleton for the doc example;ÁüÚÝ?< # // don't use this as a starting point for a real library.ÁüžÞ>; # pub struct StreamWrapper { strm: *mut std::ffi::c_void }ÁÔáÞ # const Z_OK: i32 = 0;Á”€ß # extern "C" {Áü—ß" # fn deflateGetDictionary(Áü¾ß*' # strm: *mut std::ffi::c_void,Áüíß" # dictionary: *mut u8,Áü”à%" # dictLength: *mut usize,Áœ¾à # ) -> i32;Á<ÖàÔâà # impl StreamWrapper {Áüá52 pub fn get_dictionary(&self) -> Option<Vec<u8>> {Áü»áEB // Per the FFI method's docs, "32768 bytes is always enough".Áü…â2/ let mut dict = Vec::with_capacity(32_768);Áü¼â  let mut dict_length = 0;ÁüáâMJ // SAFETY: When `deflateGetDictionary` returns `Z_OK`, it holds that:Áü³ã63 // 1. `dict_length` elements were initialized.Áüîã41 // 2. `dict_length` <= the capacity (32_768)Áü§ä.+ // which makes `set_len` safe to call.Á„Úä
unsafe {Áüïä# // Make the FFI call...Áü—åYV let r = deflateGetDictionary(self.strm, dict.as_mut_ptr(), &mut dict_length);ÁÔõå if r == Z_OK {Áü”æDA // ...and update the length to what was initialized.ÁüÝæ*' dict.set_len(dict_length);ÁÔŒç Some(dict)Á¤«ç } else {Á¤Äç NoneÁlÝ瘭Lïçý ,ýçÆ™<‡è<“辕Ÿèúü§èFC While the following example is sound, there is a memory leak sinceÁüòèA> the inner vectors were not freed prior to the `set_len` call:Á¸éú<À龕üÌé%" let mut vec = vec![vec![1, 0, 0],Áüöé%" vec![0, 1, 0],Áü ê&# vec![0, 0, 1]];ÁtËê // SAFETY:ÁüÞêFC // 1. `old_len..0` is empty so no elements need to be initialized.Áü©ë>; // 2. `0 <= capacity` always holds whatever `capacity` is.Ádìë©á¼ýë vec.set_len(0);Á,™ìÆ™<£ì¾•¯ìúü·ìEB Normally, here, one would use [`clear`] instead to correctly dropÁüí*' the contents and thus not leak memory.Á<Ôíù
 ù
ïì Üíì
ÔdŽd$áínew_lenÁ<çíü¨ô0üÔî63 Removes an element from the vector and returns it.Áïúü—ïFC The removed element is replaced by the last element of the vector.Áâïúüêï30 This does not preserve ordering, but is *O*(1).Áü¢ðFC If you need to preserve the element order, use [`remove`] instead.ÁíðúÜõð [`remove`]: Vec::removeÁ•ñúdñôá®ñúü¶ñ'$ Panics if `index` is out of bounds.ÁâñútêñÔýñú<…ò¾•ü‘ò1. let mut v = vec!["foo", "bar", "baz", "qux"];ÁÇòúüÏò(% assert_eq!(v.swap_remove(1), "bar");Áüüò)& assert_eq!(v, ["foo", "qux", "baz"]);Áªóúü²ó(% assert_eq!(v.swap_remove(0), "foo");Áüßó" assert_eq!(v, ["baz", "qux"]);Á<†ô¾•\¯ôú
 ú
ïÔdì »ôì
ƒÔdŽd$ÀôÖ,ÆôüŒõ/lõâ
Ö,õ«õüÏþ2ü‰ûJG Inserts an element at position `index` within the vector, shifting allÁüØû# elements after it to the right.Á€üúdˆüôá™üúä¡ü Panics if `index > len`.ÁÂüútÊüÔÝüú<åü¾•üñü ø€ ¬–ý vec.insert(1, 4);Áü°ý" assert_eq!(vec, [1, 4, 2, 3]);Á¬×ý vec.insert(4, 5);Áüñý%" assert_eq!(vec, [1, 4, 2, 3, 5]);Á<›þ¾•ùÖ´±þİþü§þ#4Öþû
 û
ïÔdì Ýþì
ÔdŽd$âþÖ,èþelementÁ<öþüµÿ/l¸ÿâ
Ö,ÆÿÔÿü¸+üÀ‰JG Removes and returns the element at position `index` within the vector,ÁüŠ/, shifting all elements after it to the left.ÁÊúüËŠC@ Note: Because this shifts over the remaining elements, it has aÁü“‹OL worst-case performance of *O*(*n*). If you don't need the order of elementsÁüç‹IF to be preserved, use [`swap_remove`] instead. If you'd like to removeÁüµŒ<9 elements from the beginning of the `Vec`, consider usingÁüöŒ$! [`VecDeque::pop_front`] instead.ÁŸúü§%" [`swap_remove`]: Vec::swap_removeÁüÑJG [`VecDeque::pop_front`]: alloc_crate::collections::VecDeque::pop_frontÁ Žúd¨ŽôṎúüÁŽ'à» íŽútõŽÔˆú<¾•ôœü¿ assert_eq!(v.remove(1), 2);ÁÔã assert_eq!(v, [1, 3]);Á<¾•²|Ž4¿ü
 ü
ïÔdì Æì
ÔdŽdÖü¯‘/²|—‘l²‘â
ˆÖ,À‘ΑüâžMüÞ—96 Retains only the elements specified by the predicate.Áœ˜úü¤˜NK In other words, remove all elements `e` for which `f(&e)` returns `false`.Áü÷˜LI This method operates in place, visiting each element exactly once in theÁüÈ™EB original order, and preserves the order of the retained elements.Á’šútššÔ­šú<µš¾•üÁš# let mut vec = vec![1, 2, 3, 4];Áüéš  vec.retain(|&x| x % 2 == 0);Á䎛 assert_eq!(vec, [2, 4]);Á<¯›¾•»›úüÛHE Because the elements are visited exactly once in the original order,Áüœ@= external state may be used to decide which elements to keep.ÁÕœú<Ýœ¾•üéœ&åþü”0- let keep = [false, true, true, false, true];ÁüÉ let mut iter = keep.iter();Áüí*' vec.retain(|_| *iter.next().unwrap());Áüœž assert_eq!(vec, [2, 3, 5]);Á<Àž¾•4éžþ
 þ
ï슊 óžìÍìßÖ ðžý
“"ßÖ  ý
ÔdŒŸý
ßÖ ®× ˜"$ªŸ
ÔdŽdßÖ $øž± ‚Ÿeg4ΟÄÃÝÃûÃÔdŽdßÖ  Ôd ßÖ üפUüêŸ\Y Retains only the elements specified by the predicate, passing a mutable reference to it.ÁË úüÓ RO In other words, remove all elements `e` such that `f(&mut e)` returns `false`.Áüª¡L«Ï üû¡E‚РŢútÍ¢Ôà¢ú<袾•üô¢#ˆÑ üœ£# vec.retain_mut(|x| if *x <= 3 {Á„Ä£
*x += 1;ÁdÙ£ trueÁdê£ } else {Álû£
falseÁ<¤ });Áü™¤ assert_eq!(vec, [2, 3, 4]);Á<½¤¾•TÞ¤   ïßÖ ì ì¤ìŒ× é¤ÿ
“"ßÖ  ÿ
Ôd¬–¥ÿ
ßÖ ‰Þ ˜"$§¥
ŒÔdŽdßÖ $ñ¤± û¤egüŬ+|̬âø¥¸Û à¬ÉÛ ã¬êÛLæ¬áž¤ÿ¬÷ž ŽŽ˜7ÁâÏ7âä7â÷7âä¨ÓAoqá«øÞhähä¨ÓAoqá«ܬª¬®°© ÿ¬âŽŽ‘‚¤¡­l¡­âŽŽ”í\í⎎œã­dã­âŽŽü‹®88 ¥˜˜ ¸Û ®ÉÛ “®êÛL–®ó}™"%')+”Ò®$Õ®   ó} Ú®
8Þhäh$ß®ü¡¶Öd¤¶â     ‘n  ŽŽ˜7ÁâÏ7âä7â÷7âä¨ÓAoqá« Þhäh¥œÔ8žœž ‹·Íì‘n ±¶¸Û ´¶ÉÛ ·¶Ô8œÅ¶êÛLº¶ƒ “"‘n ƒ Þh¬á·ƒ ‘nŒæ ˜"$ò·
š‘nÞhähÔ8÷7dç¶± ˆ·² Ÿ·Ÿ¡£¥¢<˶,ºÂ$±ÃüÙÇoüÂÄ\Y Removes all but the first of consecutive elements in the vector that resolve to the sameÁD£Å key.Á°Åúü¸Å96 If the vector is sorted, this removes all duplicates.ÁöÅútþÅÔ‘Æú<™Æ¾•ü¥Æ+( let mut vec = vec![10, 20, 21, 30, 20];ÁÕÆúüÝÆ" vec.dedup_by_key(|i| *i / 10);Á„ÇúüŒÇ&# assert_eq!(vec, [10, 20, 30, 20]);Á<·Ç¾•dàLj  ˆ ïßÖ ì¢œ£¢£ óÇìŒ× íÇÍìœ ðÇ “"ßÖ   Ôd”ŸÈ ßÖ ì ˜"óë °Èµßóë óë L¾È
¡ÔdŽdßÖ óë $øÇkeyÁ‚Șš4åÈ¡ÄäÝäû䤡¤ÔdŽdßÖ óë òØ Ôd€Ù üñÎeü‰É_\ Removes all but the first of consecutive elements in the vector satisfying a given equalityÁlíÉ
relation.ÁÿÉúü‡ÊWT The `same_bucket` function is passed references to two elements from the vector andÁüãÊ[X must determine if the elements compare equal. The elements are passed in opposite orderÁüÃË\Y from their order in the slice, so if `same_bucket(a, b)` returns `true`, `a` is removed.Á¤Ìúü¬Ì9Îç êÌútòÌÔ…Íú<;•ü™Í:7 let mut vec = vec!["foo", "bar", "Bar", "baz", "bar"];ÁØÍúüàÍ30 vec.dedup_by(|a, b| a.eq_ignore_ascii_case(b));Á˜Îúü Î2/ assert_eq!(vec, ["foo", "bar", "baz", "bar"]);Á<×ξ•DøÎ   ïßÖ ì¦¦ „ÏìŒ× Ï Š “"ßÖ   Ôd Š Ôdì¸Ï Š ßÖ Žõ ˜"$ÑÏ
¥ÔdŽdßÖ $‰Ï same_bucketÁ\“ψüúÐ)lÑâø¨¥©ª¨©ª¸Û “ÑÉÛ –ÑêÛL™Ñáž´ñÓ÷ž ×~€´¸ÌÔRR«¬­²ÑMOQS\þÑ$þÑâ§§d‡Ó,‡Óâ§§ñÓâ§§‘‚üœÔ:ø¯¥°±°¯±¸Û ¥ÔÉÛ ¨ÔêÛL«Ô×~²"²¡Ô,.02”åÔ$èÔŒ  Œ ×~® íÔ®
²øÞhäh$òÔüŽð ü¢í30 Appends an element to the back of a collection.ÁÚíúdâíôáóíúüûí:–âºîútÂîÔÕîú<Ýìéî let mut vec = vec![1, 2];Á„‹ï
vec.push(3);Áü ïÁ <ÄユùÖ´ÚïÄÙïüÐï#$•ð   ïÔdì šðì
³ÔdŽd$Ÿð»,¥ðüÅýAüÌó\Y Appends an element if there is sufficient spare capacity, otherwise an error is returnedÁ¬­ô with the element.ÁÇôúüÏôWT Unlike [`push`] this method will not reallocate when there's insufficient capacity.Áü«õa^ The caller should use [`reserve`] or [`try_reserve`] to ensure that there is enough capacity.Á‘öú¼™öÿìµö÷Óü×ö%àå÷út‰÷Ôœ÷úü¤÷96 A manual, panic-free alternative to [`FromIterator`]:Áâ÷ú<ê÷¾•üö÷)& #![feature(vec_push_within_capacity)]Á¤øúü¬ø*' use std::collections::TryReserveError;ÁüÛø^[ fn from_iter_fallible<T>(iter: impl Iterator<Item=T>) -> Result<Vec<T>, TryReserveError> {Áü¾ù! let mut vec = Vec::new();ÁÜäù for value in iter {Áü„úA> if let Err(value) = vec.push_within_capacity(value) {ÁüÊú$! vec.try_reserve(1)?;Áüóúda // this cannot fail, the previous line either returned or added at least 1 free slotÁüÜû85 let _ = vec.push_within_capacity(value);Ál™ü˜­L«üý |¹ü Ok(vec)Á,ÍüÆ™ü×üGD assert_eq!(from_iter_fallible(0..100), Ok(Vec::from_iter(0..100)));Á<£ý¾•¤ÌýŽ  Ž ïÔdÖ¿Ù¿Ú¿«Û¿ˆÜ¿Ý¿Þ¿ˆ‚†f|Â
Ôdì áýì
´ÔdŽd$æý»,ìýüóƒ"üŠ€LI Removes the last element from a vector and returns it, or [`None`] if itÁlÛ€
is empty.Áí€úüõ€:7 If you'd like to pop the first element, consider usingÁü´$¥É ÝúüåJ‘Ê ´‚út¼‚ÔÏ‚ú<ׂ¾•üã‚ ø€ üˆƒ# assert_eq!(vec.pop(), Some(3));Áä°ƒ³ÿ<у¾•úƒ   寧ì þƒì
µÔdŽd$ƒ„ülj*üë…IF Moves all the elements of `other` into `self`, leaving `other` empty.Á¹†údÁ†ôáÒ†úüÚ†:–♇út¡‡Ô´‡ú<¼‡¾•üȇ ø€ üí‡! let mut vec2 = vec![4, 5, 6];ÁÔ“ˆ vec.append(&mut vec2);Áü²ˆ(% assert_eq!(vec, [1, 2, 3, 4, 5, 6]);ÁÌ߈ assert_eq!(vec2, []);Á<ýˆ¾•ùÖ´“‰Ä’‰ü‰‰#4Ή    ï  ïì Õ‰ì
ÔdŽd$Ú‰¹
,à‰üå‹7ùÖ´±‹İ‹ü§‹#|ï‹â   ï óeì ÿ‹ì
·ÔdŽd$„Œ¹
,ŠŒüç–`ü’ŽFC Removes the specified range from the vector in bulk, returning allÁüÝŽFC removed elements as an iterator. If the iterator is dropped beforeÁü¨B? being fully consumed, it drops the remaining removed elements.Áïúü÷JG The returned iterator keeps a mutable borrow on the vector to optimizeÁ¼Æ its implementation.Áâúôáûúüƒ‘DA Panics if the starting point is greater than the end point or ifÁüÌ‘;8 the end point is greater than the length of the vector.ÁŒ’úl”’
# LeakingÁ¦’úü®’LI If the returned iterator goes out of scope without being dropped (due toÁüÿ’FC [`mem::forget`], for example), the vector may have lost and leakedÁüÊ“?< elements arbitrarily, including elements outside the range.ÁŽ”út–”Ô©”ú<±”¾•ô½”üà”+( let u: Vec<_> = v.drain(1..).collect();ÁÄ assert_eq!(v, &[1]);ÁÜ­• assert_eq!(u, &[2, 3]);ÁÍ•úüÕ•:7 // A full range clears the vector, like `clear()` doesÁ„”–
v.drain(..);Á¼©– assert_eq!(v, &[]);Á<Å–¾•,î–   »è(¿)âÀŸ)âÁùâÂÁâÄ­KKtƒLÇ ÔdŽd죹¹ ÷–ìÍ캛
ô–¤#º›
”´—
¸ÔdŽdº›
$ü–rangeÁ,‚—>@¼¤¦üÙ£+( Clears the vector, removing all values.Á‰¤úü‘¤Aúü”פÅýî¤útö¤Ô‰¥ú<‘¥¾•ô¥À¥útÈ¥ v.clear();ÁÛ¥úÔ㥠assert!(v.is_empty());Á<‚¦¾•,«¦   ïì ±¦ì
ºÔdŽd$¶¦Ô®¬ü¾ªB? Returns the number of elements in the vector, also referred toÁ¤…« as its 'length'.Áž«út¦«Ô¹«ú<Á«¾•ÔÍ« let a = vec![1, 2, 3];ÁÜì« assert_eq!(a.len(), 3);Á<Œ¬¾•µ¬   ïì ¹¬ì
»ÔdŽd$º¬ôí®üç¬63 Returns `true` if the vector contains no elements.Á¢­útª­Ô½­ú<Å­¾•ÜÑ­ let mut v = Vec::new();ÁÔñ­‚ž
®út˜®¿§Ü«® assert!(!v.is_empty());Á<Ë®¾•Dô®   ïì ý®ì
¼ÔdŽd$þ®üá´Jü±¯63 Splits the collection into two at the given index.Áì¯úüô¯IF Returns a newly allocated vector containing the elements in the rangeÁü°LI `[at, len)`. After the call, the original vector will be left containingÁü“±@= the elements `[0, at)` with its previous capacity unchanged.Áرúdà±ôáñ±úÌù± Panics if `at > len`.Á—²útŸ²Ô²²ú<º²¾•üƲ ø€ üë²  let vec2 = vec.split_off(1);Á̳ assert_eq!(vec, [1]);Á쮳 assert_eq!(vec2, [2, 3]);Á<г¾•ùÖ´æ³Äå³üܳ#.üš´B2use `.truncate()` if you don't need the other halfÁLè´   ïïì ò´ìþª,¥µ
½ÔdŽd$÷´atÁý´üãµ,læµâ
¾Ȫ
ôµÿµü³ÅYüÙ¼C@ Resizes the `Vec` in-place so that `len` is equal to `new_len`.Á¡½úü©½DA If `new_len` is greater than `len`, the `Vec` is extended by theÁüò½C@ difference, with each additional slot filled with the result ofÁüº¾C@ calling the closure `f`. The return values from `f` will end upÁü‚¿74 in the `Vec` in the order they have been generated.Á¾¿úüÆ¿C@ If `new_len` is less than `len`, the `Vec` is simply truncated.ÁŽÀúü–ÀEB This method uses a closure to create new values on every push. IfÁüàÀEB you'd rather [`Clone`] a given value, use [`Vec::resize`]. If youÁüªÁA> want to use the [`Default`] trait to generate values, you canÁüðÁ52 pass [`Default::default`] as the second argument.ÁªÂút²ÂÔÅÂú<;•üÙ ø€ üþÂ)& vec.resize_with(5, Default::default);Áü¬Ã%" assert_eq!(vec, [1, 2, 3, 0, 0]);ÁÖÃúÌÞà let mut vec = vec![];Á”üà let mut p = 1;Áü“Ä)& vec.resize_with(4, || { p *= 2; p });ÁüÁÄ# assert_eq!(vec, [2, 4, 8, 16]);Á<éľ•ùÖ´ÿÄÄþÄüõÄ#\ºÅ˜  ˜ ïßÖ ìÀÀ ÉÅìŒ× ÆÅ“"ßÖ dÿÅßÖ ˜"Ôd ŠÆ
¿ÔdŽdßÖ $ÎÅ«¸ <Ôű äÅY[üüÎ=üÙÇPM Consumes and leaks the `Vec`, returning a mutable reference to the contents,Áü®ÈJG `&'a mut [T]`. Note that the type `T` must outlive the chosen lifetimeÁüýÈKüÍÉ"éôÉúüüÉIF As of Rust 1.57, this method does not reallocate or shrink the `Vec`,ÁüÊÊIF so the leaked allocation may include unused capacity that is not partÁÔ˜Ë of the returned slice.Á·Ëúü¿ËK£ŽüÌKùŽLßÌ leak.ÁíÌútõÌÔˆÍúŒÍí’¦Íú<®Í¾•ÔºÍ let x = vec![1, 2, 3];ÁüÙÍ41 let static_ref: &'static mut [usize] = x.leak();Á¼’Î static_ref[0] += 1;Áü®Î'$ assert_eq!(static_ref, &[2, 2, 3]);Á<Úξ•$ƒÏï øóeìøÂÂ줘¶Ï
ÁÔdŽdø$ŒÏˆÏü£×=ü¿ÐDA Returns the remaining spare capacity of the vector as a slice ofÁ¬ˆÑ `MaybeUninit<T>`.Á¢ÑúüªÑHE The returned slice can be used to fill the vector with data (e.g. byÁü÷ÑIF reading from a file) before marking the data as initialized using theÁ¼ÅÒ [`set_len`] method.ÁáÒúìéÒ [`set_len`]: Vec::set_lenÁ‹Óút“ÓÔ¦Óú<®Ó¾•üºÓ2/ // Allocate vector big enough for 10 elements.ÁüñÓ'$ let mut v = Vec::with_capacity(10);ÁÔúü¥Ô$! // Fill in the first 3 elements.ÁüÎÔ(% let uninit = v.spare_capacity_mut();Á¼ûÔ uninit[0].write(0);Á¼—Õ uninit[1].write(1);Á¼³Õ uninit[2].write(2);ÁÏÕúü×ÕDA // Mark the first 3 elements of the vector as being initialized.Ád Ö©á¬±Ö v.set_len(3);Á,ËÖÆ™ÕÖúüÝÖ assert_eq!(&v, &[0, 1, 2]);Á<×¾•”ª×   ï  ‰œì ½×ì
ÃÔdŽd$Â×ü÷èIüÑÚLI Returns vector content as a slice of `T`, along with the remaining spareÁü¢Û:7 capacity of the vector as a slice of `MaybeUninit<T>`.ÁáÛúüéÛNK The returned spare capacity slice can be used to fill the vector with dataÁü¼ÜNK (e.g. by reading from a file) before marking the data as initialized usingÁÜÝ the [`set_len`] method.Á¯Ýúì·ÝÓ¿
ÙÝúüáÝIF Note that this is a low-level API, which should be used with care forÁü¯Þ@= optimization purposes. If you need to append data to a `Vec`ÁüôÞ<9 you can use [`push`], [`extend`], [`extend_from_slice`],ÁüµßA> [`extend_from_within`], [`insert`], [`append`], [`resize`] orÁüûß30 [`resize_with`], depending on your exact needs.Á³àú¼»àÿÜ×à [`extend`]: Vec::extendÁü÷à1. [`extend_from_slice`]: Vec::extend_from_sliceÁü­á30 [`extend_from_within`]: Vec::extend_from_withinÁÜåáÓÓÜ…â [`append`]: Vec::appendÁÜ¥âõ  üÅâ%" [`resize_with`]: Vec::resize_withÁïâút÷âÔŠãú<’㾕üžã# #![feature(vec_split_at_spare)]ÁÆãúôÎã let mut v = vec![1, 1, 2];Áñãúüùã;8 // Reserve additional space big enough for 10 elements.Á”¹ä v.reserve(10);ÁÐäúüØä0- let (init, uninit) = v.split_at_spare_mut();Áüå0- let sum = init.iter().copied().sum::<u32>();ÁÂåúüÊå# // Fill in the next 4 elements.ÁÌòå uninit[0].write(sum);Áìæ uninit[1].write(sum * 2);Áì²æ uninit[2].write(sum * 3);ÁìÔæ uninit[3].write(sum * 4);Áöæúüþæ>; // Mark the 4 elements of the vector as being initialized.ÁdÁç©áÔÒç let len = v.len();ÁÜñç v.set_len(len + 4);Á,‘èÆ™›èúü£è-* assert_eq!(&v, &[1, 1, 2, 4, 8, 12, 16]);Á<Õ辕”þèš  š ï š óe š ‰œì ‘éì
ÄÔdŽd$–éü¾ìpÜÈìâ   ï  óe  ‰œ  ì íìì
ÅÔdŽd$òìüóó&¥ÇÈÇÈÈÕ øóæÑ ‚ôåª,ûóŒL…ôïÉÊË,.02üæû2ü ôC®«
èôúüðôD‰¬
ü¹õ>; difference, with each additional slot filled with `value`.ÁüüõCî
ÄöúüÌö41 This method requires `T` to implement [`Clone`],Áü…÷2/ in order to be able to clone the passed value.Áü¼÷KH If you need more flexibility (or want to rely on [`Default`] instead ofÁüŒø)& [`Clone`]), use [`Vec::resize_with`].ÁüºøHE If you only need to resize to a smaller size, use [`Vec::truncate`].Á‡ùútùÔ¢ùú<ªù¾•ü¶ù  let mut vec = vec!["hello"];ÁÜÛù vec.resize(3, "world");Áüûù1. assert_eq!(vec, ["hello", "world", "world"]);Á±úúü¹ú#ˆÑ ¬áú vec.resize(2, 0);Áäûú³ÿ<œû¾•ùÖ´²ûıûü¨û#4íûœ  œ ïÔdÆ ôûÆ
ÉÔdŽd$ùû«¸ <ÿû»,üüÃ0üáý<9 Clones and appends all elements in a slice to the `Vec`.Á¢þúüªþJG Iterates over the slice `other`, clones each element, and then appendsÁüùþ>; it to this `Vec`. The `other` slice is traversed in-order.Á¼ÿúüÄÿC@ Note that this function is same as [`extend`] except that it isÁüŒ€B? specialized to work with slices instead. If and when Rust getsÁüÓ€EB specialization this function will likely be deprecated (but stillÁ| available).Á±úÔÌú¾•ÔàåÊüÿ&# vec.extend_from_slice(&[2, 3, 4]);Áüª‚" assert_eq!(vec, [1, 2, 3, 4]);Á<Ñ‚¾•Ý‚úÜå‚êË
ùÖ´ƒÄŽƒü…ƒ#ŒÊƒ ž   ï ž óeÆ ܃Æ
ÊÔdŽd$ჹ
,çƒüö‰Xü¬„>; Copies elements from `src` range to the end of the vector.Áï„úd÷„ôህúüDƒ”
üÙ…;Ò”
™†út¡†Ô´†ú<¼†¾•üȆ&# let mut vec = vec![0, 1, 2, 3, 4];Áó†úüû†  vec.extend_from_within(2..);Áü ‡.+ assert_eq!(vec, [0, 1, 2, 3, 4, 2, 3, 4]);ÁÓ‡úüÛ‡  vec.extend_from_within(..2);Áü€ˆ41 assert_eq!(vec, [0, 1, 2, 3, 4, 2, 3, 4, 0, 1]);Á¹ˆúüÁˆ! vec.extend_from_within(4..8);Áüçˆ@= assert_eq!(vec, [0, 1, 2, 3, 4, 2, 3, 4, 0, 1, 4, 2, 3, 4]);Á<¬‰¾•ùִ‰ÄÁ‰ü¸‰#”ý‰Ÿ  Ÿ ﺛ
Æ£ÌÌ “ŠÆÅœ
Šל
”»Š
ËÔdŽdº›
$˜ŠsrcÁžŠ13d”“ËÄÃÍÝÃÍûÃÍÍËÍÔdŽdº›
†¥ ±Ý Ôd¡•ËÄÃÎÝÃÎûÃÎÎËÎÔdŽdº›
Úí
  üº•4¥ÐÑŸÒÒÐÑÈÕ ¿•æÑ •‹êtЕŒLÅ•ââöå€.âæâ¨ñ'N-yDkŽdÔcegik Ö•üÀ›(üõ•:7 Takes a `Vec<[T; N]>` and flattens it into a `Vec<T>`.Á´–úd¼–ôáÍ–úüÕ–JG Panics if the length of the resulting vector would overflow a `usize`.Á¤—úü¬—JG This is only possible when flattening a vector of arrays of zero-sizedÁüû—:7 types, and thus tends to be irrelevant in practice. IfÁüº˜0- `size_of::<T>() > 0`, this will never panic.Áï˜út÷˜ÔŠ™ú<’™¾•ôž™ #![feature(slice_flatten)]ÁÁ™úüÉ™85 let mut vec = vec![[1, 2, 3], [4, 5, 6], [7, 8, 9]];Áü†š+( assert_eq!(vec.pop(), Some([7, 8, 9]));Á¶šúü¾š-* let mut flattened = vec.into_flattened();Áüðš)& assert_eq!(flattened.pop(), Some(6));Á<ž›¾•tÇ›¾ï
ïÏÏ
ÔÔdŽdŸ$Ö›œë£Tñ£âÕ¥ÖÖÕü×üë£L¸Û ü£Õü×#üררר46Ä…¤$ˆ¤â     „ØÞhÕ ¤Õ
ׄØÞh$’¤œ¢¤$¥¤â„ØÞhÕÕ
Ø„ØÞh$ª¤¥TlÀ¤â¥ÛÛÈÕ Τ°S™8ñÚÜÔd°¥TQâÔd°ÙÙ
ÚÔdgi ѤâÙÙÔdüÕ¤1¥ÞÞÈÕ Ú¤åª,ݤ°ßàרßà')¼£¥$¦¥â¡  ¡ °ÔdÝ «¥Ý
ßÔd$°¥”õ¥$ø¥â°ÔdÝÝ
àÔd$ý¥ü¢¦¥âãâãÈÕ §¦æÑ ª¦ŒL­¦ïä!#üʧCùÖ´Ò¦ÄѦüȦ#\ͧ⢠ ¢ ïáåå ë§áÍì§þ
Ù§Õ§þ
Ôdlܧ
äÔdŽd§þ
$ð§¹ ö§»,„¨BDü¢¯*¥çèèçÈÕ §¯æÑ µ¯šµLª¯ŒL¸¯ïé&(*,¼Ú²üÓ¯HE Removes consecutive repeated elements in the vector according to theÁü °'$ [`PartialEq`] trait implementation.Á̰úüÔ°9Îç ’±útš±Ô­±ú<µ±¾•üÁ±&# let mut vec = vec![1, 2, 2, 3, 2];Áì±ú„ô±
vec.dedup();Á‰²úü‘²" assert_eq!(vec, [1, 2, 3, 2]);Á<¸²¾•,á²£  £ ïæ ç²æ
éÔdŽd$ì²4гéÄÃêÝÃêûÃêêéêÔdŽdüí üí´.¥ìíìíÈÕ ò´æÑ õ´ŒLø´ïîïê!ë!ï,.02\¢µ4§µëëóe¼Ðµ,Óµ¤  ¤ ï ¤ óeë Ùµë
ïÔdŽd$Úµüµ¶1¥ñòòñÈÕ º¶æÑ ½¶ŒLÀ¶ïó÷!ó%')+üƒ·#L†·¥  ¥ ï ¥ óeð ·ð
óÔdŽd$•·ü ¸8ùÖ´†¸Ä…¸üü·#¥õööõÈÕ ¥¸æÑ ¯¸åª,¨¸ŒL²¸þª,¾¸ï÷øÙÚ÷øBDFH¼õ¸,ø¸¦  ¦ ïïô þ¸ô
÷ÔdŽd$ÿ¸üϺ&TÒº§ ¨  § ï ¨ ïô ݺô
øÔdŽd$⺹
,èºü¹Á.ü¾HE The hash of a vector is the same as that of the corresponding slice,ÁüÖ¾=: as required by the `core::borrow::Borrow` implementation.Á”¿ú<˜¿¾•ü ¿-* #![feature(build_hasher_simple_hash_one)]Áüο use std::hash::BuildHasher;Áî¿úüò¿;8 let b = std::collections::hash_map::RandomState::new();Áü®À,) let v: Vec<u8> = vec![0xa8, 0x3c, 0x09];ÁüÛÀ'$ let s: &[u8] = &[0xa8, 0x3c, 0x09];ÁüƒÁ-* assert_eq!(b.hash_one(v), b.hash_one(s));Á<±Á¾•¥úûúûÈÕ ¾ÁæÑ ÇÁÁÂ$ÁÁŒLÊÁïü›eü.024ü„Â($‡Â© ª  © ï ª ÄÃùýý —Âùòà ŒÂ„Ä4Â
üÔdŽdÄÃ$˜Âº,žÂ.0üÛÂ@¥ÿšÿÈÕ àÂÉà ãÂÉÛ ÷“k°róe|æÂêÛLúÂ{‚ƒÛ¢Ü¢ƒJLNPRT\¢Ã4§Ãþþ°róe•küÖÃ*,Ùë  « {°r « {°rÛ¢þ ßÃþ
ƒÔd°räh$àÃÖ,æÃü±ÄC¥šÈÕ ¶ÄÉà ¹ÄÉÛ ÍÄÇ’ |¼ÄêÛLÐĵ"ˆ79;=?Aü‘Å6L”Ŭ  ¬ {°r ¬ †”  žÅ
ˆÔd°räh$£ÅÖ,©Åü§Æ"ùÖ´ÆÄŒÆüƒÆ#¥ŠŠÈÕ ¬Æï€ÅLüæÆ:L鯰rŒŒÉà óÆÚôöưrÈLÔdDƒÇ
Ôd°rù$ŽÇ46üôÇ0¥ŽŽÈÕ ùÇæÑ üÇŒLÿÇïÈLÉLÊL3579L«È$°ÈÔdl¾ÈDÃÈŽvüªÍ$üãÈKH Creates a consuming iterator, that is, one that moves each value out ofÁü³ÉKH the vector (from start to end). The vector cannot be used after callingÁLƒÊ this.Á‘Êút™ÊÔ¬Êú<´Ê¾•üÀÊ30 let v = vec!["a".to_string(), "b".to_string()];ÁüøÊ# let mut v_iter = v.into_iter();Á Ëúü¨Ë63 let first_element: Option<String> = v_iter.next();ÁãËúüëË52 assert_eq!(first_element, Some("a".to_string()));Áü¥Ì52 assert_eq!(v_iter.next(), Some("b".to_string()));ÁüßÌ$! assert_eq!(v_iter.next(), None);Á<ˆÍ¾•L­ÍïïÉL
ÔdŽd$·ÍüßÒ8ø¥¸Û èÒÉÛ ëÒêÛLîÒØÈLÉLÊLäÒ;=?ALžÓ$£Ó´‚lµÓDºÓ© üôÓ$L÷ÓÃÃÉL
øÞhäh$Ôü¸Ô<ø¥œœ¸Û ÁÔÉÛ ÄÔêÛLÇÔ‘‚žŸ ÈLÉLÊL ½Ô;=?ALûÔ$€Õšš øÞhl–ÕD›ÕššÜlÜlIterMutÁßlµ ™làlÌŸ™lál·J™lÚ½íDþïl%øÞhüÂÕ$LÅÕ‘‚‘‚ÉLšš
 øÞhäh$ÏÕü®Ö-ùÖ´”ÖÄ“ÖüŠÖ#¥¢£¢£ÈÕ ³ÖæÑ ¶ÖŒL¹Öï¤ÒL¤%')+üøÖ84ûÖ­  ­ ïš¡š¥¥ ×¡Íì´¦ ‚×ÇL´¦ ´…×´¦ ÈLÔdD’×
¤ÔdŽd´¦ $¢×ù$¨×IKü£Þ¥§¨¨§ÈÕ ¨ÞæÑ «ÞŒL®Þï©!#ü¥é£üÉÞOL Creates a splicing iterator that replaces the specified range in the vectorÁüßHE with the given `replace_with` iterator and yields the removed items.ÁüêßB? `replace_with` does not need to be the same length as `range`.Á±àúü¹àJG `range` is removed even if the iterator is not consumed until the end.ÁˆáúüáC
ü©æ;Ò”
éæútñæÔ„çú<Œç¾•ü˜ç! let mut v = vec![1, 2, 3, 4];Áľç let new = [7, 8, 9];ÁüÛç2/ let u: Vec<_> = v.splice(1..3, new).collect();Áü’è$! assert_eq!(v, &[1, 7, 8, 9, 4]);ÁÜ»èÖ˜
<Û辕ùÖ´ñèÄðèüçè#4¬é®  ® ﺛ
ô–õõµOù(âúãOâÙml¶ð™‡ž® ô–ÉLŽd¦£ªš«ª« ¹é¦Åœ
³é — ¶éל
”’êÇLô–´±êô–ÈLÔdD¾ê
©ÔdŽdº›
ô–$¾éƒœ
,ÄéãOdÎéikmoü’îEüÍëb_ Extend implementation that copies elements out of references before pushing them onto the Vec.Á°ìúü´ì`] This implementation is specialized for slice iterators, where it uses [`copy_from_slice`] toÁü•í$! append the entire slice at once.Áºíúü¾í/, [`copy_from_slice`]: slice::copy_from_sliceÁùÖ´øíÄ÷íüîí#ø­¥®¯¯®­¸Û ›îÉÛ ©îÚÛ$žîឥîêÛL¬î÷ž¸îɰÒL°—îHJ­OQ­üôî<4÷î¯  ¯ Éô–¬š±± ﬠ— þîд Ôïô–ÈL´‚dŽï
°øÞhähô–$¢ïù$¨ïHJü­õ:üÇôeb Implements comparison of vectors, [lexicographically](core::cmp::Ord#lexicographical-comparison).Á¥³´´³ÈÕ ²õæÑ Áõœ¸TµõŒLÄõïµïßµ/135ü„ö7\‡ö° ±  ° ï ± ïÖ¹² “ö²
µÔdŽd$”ö¹
,šöüúö*¥·¸¸·ÈÕ ÿöæÑ †÷ËÁ‚÷ŒL‰÷ï#%')üø,ü©÷c` Implements ordering of vectors, [lexicographically](core::cmp::Ord#lexicographical-comparison).Á¥º»º»ÈÕ ’øæÑ šøп•øŒLøï¼»¼.024üÖø'Ùø² ³  ² ï ³ ¹ Ýø¹
¼ÔdŽd$Þø¹
,äøü­ù(¥¾¿¾¿ÈÕ ²ùæÑ µùŒL¸ùïÀ"À%')+”òù$õù´  ´ ï½ úù½
ÀÔdŽd$ÿùÔðü¥ÂÂÈÕ õüï€Ã´Ã´šþô‘ý Creates an empty `Vec<T>`.Á´ýúü¼ýC©×<þï€ÁÁ
ÃÔdüÏþ:¥ÅÆÆÅÈÕ ÔþæÑ ãþ›˜T×þŒLæþïÇÀcÇ.024ü¦ÿ8©ÿµ  ·  µ ï   c cˆ¢cµ
 `£c€. `àB¤GS
· ²¾Ä ­ÿÄ
ÇÔdŽd$®ÿ± ´ÿüŽ€4¥ÉÊÉÊÈÕ “€æÑ –€ŒL™€ïËâË%')+ô߀4‸  ¸ ï«È È é€È
ËÔdŽd$ê€ü–4¥ÍÎÍÎÈÕ æÑ žŒïÏåÏ%')+üç&¹  ¹ ïüÉ Ì ñÌ
ÏÔdŽdü¦‚.¥ÑÒÑÒÈÕ «‚æÑ ®‚ŒL±‚ïÓâÓ%')+Äñ‚4ô‚º  º ï º óeÐ û‚Ð
ÓÔdŽd$ü‚ü¢ƒ.¥ÕÖÕÖÈÕ §ƒæÑ ªƒŒL­ƒï×å×%')+üíƒ 4ðƒ»  » ï » óeÔ ÷ƒÔ
×ÔdŽd$üƒüÊ„$ùÖ´°„į„ü¦„#8¼ ¥ÙÙ¼ ¸Û Ï„ØÞh,Ò„ºƒÚëÚ$&ÔĆüõ„;8 Allocate a `Vec<T>` and fill it by cloning `s`'s items.Áµ…út½…ÔÐ…ú<Ø…¾•üä…96 assert_eq!(Vec::from(&[1, 2, 3][..]), vec![1, 2, 3]);Á<¢†¾•$dž½  ½ ÝhºƒØ φØ
Ú8Þh¾ ̆üï‡(ùÖ´Õ‡ÄÔ‡üˇ#8¾ ¥Ü¾ Ü¸Û ô‡¶Î ,÷‡ºƒÝëÝôñ‰üžˆ;òÍ ÞˆútæˆÔùˆú<¾•ü=: assert_eq!(Vec::from(&mut [1, 2, 3][..]), vec![1, 2, 3]);Á<ω¾•$ô‰¿  ¿ ÝhºƒÛ ü‰Û
Ý8Þh¾ ù‰ü ‹/ùÖ´†‹Ä…‹üüŠ#¥ßŸààßÈÕ ¥‹Íìt¨‹ï€âëâ! ®‹äì‹$ï‹Êjï€ÞÞ
âÔdŸ¾ ô‹ü¿Œ5¥åæåæÈÕ ÄŒæÑ ÇŒŒLÊŒïçëç%')+üªüûŒDA Convert a boxed slice into a vector by transferring ownership ofÁüÄ! the existing heap allocation.ÁêúÔ…Žú<޾•ü™Ž96 let b: Box<[i32]> = vec![1, 2, 3].into_boxed_slice();Áü׎,) assert_eq!(Vec::from(b), vec![1, 2, 3]);Á<ˆ¾•$­¼eïää
çÔdŽd¾ ²üêH¥éêŸëëéêÈÕ ïæÑ ò‹êt€Œïíëí.0246 üÞ’"ü¹DA Convert a boxed array into a vector by transferring ownership ofÁü‚‘! Ö ¨‘út°‘ÔÑú<Ë‘¾•üב/, let b: Box<[i32; 3]> = Box::new([1, 2, 3]);Áü‹’,Æ× <¼’¾•$á’Újïèè
íÔdŽdŸ¾ æ’üý“5ùÖ´ã“Äâ“üÙ“#¥ðñðñÈÕ ‚”æÑ …”ŒLˆ”¼eòëò%')+ìõ˜ü¹”(% Convert a vector into a boxed slice.Áæ”úüî”>; If `v` has excess capacity, its items will be moved into aÁü±•;õñ•útù•ÔŒ–ú<”–¾•ü KH assert_eq!(Box::from(vec![1, 2, 3]), vec![1, 2, 3].into_boxed_slice());Á<𖾕ü–úü„—#š÷<¬—¾•ü¸—)ŒãÔæ—×ì…˜úü˜A> assert_eq!(Box::from(vec), vec![1, 2, 3].into_boxed_slice());Á<Ó˜¾•$ø˜ï¼eïï
òÔdŽdÁ ý˜Üß™ùÖ´Å™ÄÄ™ü»™#8À À Ç„ôëôÜΛüš96 Allocate a `Vec<u8>` and fill it with a UTF-8 string.Á¿šútÇšÔÚšú<âš¾•üîš96 assert_eq!(Vec::from("123"), vec![b'1', b'2', b'3']);Á<¬›¾•$Ñ›Á  Á Ç„ó Ù›ó
ô8¾ Ö›ü–œC¥ö÷Ÿø÷öøÈÕ ›œæÑ žœ‹êt¬œŒL¡œ‘kúûòóû5
v.sort();Á”‚£ v.truncate(2);Áü™£/, let [a, b]: [_; 2] = v.try_into().unwrap();ÁÄÍ£ assert_eq!(a, b' ');ÁÄê£ assert_eq!(b, b'd');Á<‡¤¾•D¬¤ïÖ¿Ù¿Ú¿«Û¿ˆÜ¿Ý¿Þ¿ˆ‚†f|Â
‘kïõõ
ûÔdŽdŸÁ¹¤üÝ©UùÖ´´©ij©üª©#4Ô©dä©ÔdŽdï¥ÿÿÈÕ ñ©æÑ û©åª,ô©ŒLþ©
þÔdŽdelemÁ$‰ª¹ ’ª¤,œªJLNPüß«7ùÖ´¶«ĵ«ü¬«#4Ö«Læ«ÔdÈÕ ð«åª,ó«
ÔdÐð $ú«¹ ƒ¬)+»¤Œ°̪„ú ü/ , Creates a [`Vec`] containing the arguments.Á0 úü4Q N `vec!` allows `Vec`s to be defined with the same syntax as array expressions.Áü†& # There are two forms of this macro:Á­ úü±; 8 - Create a [`Vec`] containing a given list of elements:Áí ú ¾•äù  use allocator_api2::vec;ÁÔ– ¦ı  assert_eq!(v[0], 1);ÁÄÊ  assert_eq!(v[1], 2);ÁÄã  assert_eq!(v[2], 3);Á ¾• úˆ ú ¾•ü”- * use allocator_api2::{vec, alloc::Global};ÁüÂ% " let v = vec![in Global; 1, 2, 3];ÁÄè Ðõ Ä ñõ Äš ’ö  ¾•» úü¿5 2 - Create a [`Vec`] from a given element and size:Áõ ú ¾•ä žõ ¼ž  let v = vec![1; 3];Áì¶  assert_eq!(v, [1, 1, 1]);Á ¾•Ü ú ¾•üè- æö ü–"  let v = vec![in Global; 1; 3];Áì¹ ù  ¾•ß úüãH E Note that unlike array expressions this syntax supports all elementsÁü¬K H which implement [`Clone`] and the number of elements doesn't have to beÁ a constant.Áˆ úüŒN K This will use `clone` to duplicate an expression, so one should be carefulÁüÛJ G using this with types having a nonstandard `Clone` implementation. ForÁü¦ J G example, `vec![Rc::new(1); 5]` will create a vector of five referencesÁüñ R O to the same boxed integer value, not five references pointing to independentlyÁœÄ
 boxed integers.ÁØ
úüÜ
M J Also, note that `vec![expr; 0]` is allowed, and produces an empty vector.Áüª Z W This will still evaluate `expr`, however, and immediately drop the resulting value, soÁü…   be mindful of side effects.Á¥ úä©  [`Vec`]: crate::vec::VecÁùÖ´Ð ÄÏ üÆ # (|ê U
î 
¦
8
,
8¤,
&
8
, ¡
 ¢
¤
% £
- ¥
*¨
 «
Ú
 , µ
8
'»
8Á½
'À
8öÂ
'Å
8Û
 Í
Ô
, Î
8¤
% Û
 á
 8â
, å
8¤
& ë
8
% ð
, ò
8Ðð
& ÷
8
% ü
, þ
8¹ ÿ
&  8$ *  Š Å ,  8,• 'š 8Áœ 'Ÿ 8ÑG  ­ ¿ , ® 8Ðð  $ ³ , µ 8¹  $ · , ¹ 8¤ % Æ  Ì ï 
8Í , Ð 8¤ & Ö 8$× % Û , Ý  Þ æ , ß 8Ã à & á 8 $ ç  è , ê  ë í $ ì - î *ñ  ô ¤ 
, þ 8,ÿ ' 8ä,† ' 8ˆ '      8    ' 8ˆ
D™  ¡ ž , ¯ 8 'µ 8ä '¼ 8ˆ¾ 'Á 8ž  È  , Ú 8 'à 8ä 'ç 8ˆé 'ì 8Û   ô   õ ý , ö  ÷ ú , ø 8à ù $ û  ü $ þ ,  8¤, % ¥  « ¬ *®  ± ×  , » 8 'Á 8Áà 'Æ 8öÈ 'Ë 8æ Í  Ð Ñ % Ø  Þ ò  , ß 8Ðð  & ä 8 % é , ë 8¹ ì & í 8 *ô  ÷ § ,  8, ' 8Á 'Œ 8õG   ¡ , ˜ 8Ðð $™ $  , Ÿ 8¹   % ¨  ® Á , ¯  ° ¸ , ± 8à ² & ³ 8$´ $ ¹  º , ¼  ½ ¿ $ ¾ - À *à  Æ ë 
, Ð 8 'Ö 8ä 'Ý 8ˆß 'â  ä  å ç 8 æ  è 'é 8ˆ
  ó å ,  8, ' 8ä,‰ 'Ž 8ˆ ' 8ž,•  š Û , ¬ 8,­ '² 8ä,´ '¹ 8ˆ» '¾ 8æ À  Ã Í  Ä Ì , Å  Æ É , Ç 8Ã È $ Ê  Ë % ì »¤Œ×ÌÑèL
1ˆ¾L4$
Ä(¾LÅ(ö6
âŠ,

Y[JLD1
"¬{
ü?;
8 Slice methods that use `Box` and `Vec` from this crate.ÁD…
¥ŒŒü×ü{Œ
¸Û Ž
ü×!ü×'ŽŽŽ<>ü®>
ü—#
Copies `self` into a new `Vec`.Á¿
ú
ÔÚ
ú
¾•Ìî
 let s = [10, 40, 30];Á¼Œ