Files
Deshab-OS/CODE/Deaicup Software/pe/target/x86_64-pc-windows-msvc/release/deps/libscopeguard-fed636edc3fb0fc5.rlib
T

82 lines
28 KiB
Plaintext
Raw Normal View History

!<arch>
/ 0 0 0 0 4 `
/ 0 0 0 0 16 `
žg// 70 `
scopeguard-fed636edc3fb0fc5.scopeguard.76ddd565be7330d7-cgu.0.rcgu.o
lib.rmeta/ 0 0 0 644 26187 `
d†5f.rmetaùe<rust
[d#rustc 1.95.0 (59807616e 2026-04-14)ÁûKn�c8’ÞIK/�%W-7c4a4c66f69609a4Á²B÷è:£¢¬-Y4^ˆ&8ö-c5c18940a57badd0Á‰OnUnwindÁDÀ6Íuse_stdÁœ�6 OnSuccessÁLà7Ížœ°7defer_on_successÁ„§?Ížœô>defer_on_unwindÁ|²BÍžœÿAguard_on_successÁ„”[ÍžœáZguard_on_unwindÁ|öbÍžœÃbtestsÁ,¤nö$™nûºStrategyÁ 
should_runÁ
¾deferÁ
ScopeGuardÁTÁFÁSÁ®dropfnÁstrategyÁ÷ÿ‡
with_strategyÁ
into_innerÁguardÁ÷ÿ ÷ ÿ ‡$÷$ÿ$‡$ò$Ã*÷*ÿ*‡*Å/÷/ÿ/‡/ð4÷4ÿ4‡4áAlwaysÁ:á)
.
3
8
8
8
;
;
;
 Åb9{LüŽ]Ÿ” èÄæ®–£')Ð˪®÷ÿ‡¢!�¯!�Å!�Åb�:94
9 $*/Åb# 
Ä¢!¯!Å!(›5;£…¦…§…¸¨…ú©…ª…Œ«…ú¢ÈŸÙ6�ŒŠŽŠŽ‹ŽErrorÁ …Ê:{KTiP˜ è¢ ¦b¦b•¨b°
¦_©bbufÁ¦_üØ ÷Qy¬jèñ¹þ$Å8Ï8ü£8,$¶8
¤¡MÍÑ4{…È| ª¡Ëý»41{ –¡Ë
ë4{ÌËMQN ª¡ÑK –¡ÑGü�M‘ ËÑ×÷ÉÉÊ PhantomDataÁÔ²ÑæÊÜêd×× ‘N˜NüºLÞýƒ4o{ÊË2ýÿ_|íË?+ÊÑ'íÑb�œãLË ÏLÑ4ÕL–¡–¡ ManuallyDropÁ˜¡®º„ð«0ÇË9MËÍ–¡–¡Å˜¡®º„ð«0ÇË9Mѵª¡ª¡«¡
MaybeDanglingÁ­¡úç ¼ß° +‹ÉËIª¡ª¡«¡È­¡úç ¼ß° +‹ÉчvÁ–"œL‡UÄ ª¡�À –¡�½ýÓÑ%† ª¡ª¡«¡È­¡úç ¼ß° +‹É��¹·Ë�åR{  Ê�þ‚ÑýÒR'{ Ù
ðÑE#
øR{  öW÷WüâS•üƒUôüÊU§ÖÊ�Ä“UÔí�ýâT9{Ó�\âUýã8|î�E�U{.ÓËdáU*îË&ý›¿å†ŸËÄÖUýêVE{Ö�dÇWý¨D|
ï�E¡W{
ý‰Pø{ÏÑü¯W%0 ïÑEðR{ Ë „T�,ôS–¡–¡Å˜¡®º„ð«0ÇË9M�f²
kÊ1 ÑÜ ð^ð—®,ÎU—Ìê
‡†„ ª¡Ë‚ –¡Ë}´½ ª¡ÑÉ –¡ÑÆ€ ËÑèmÉÉÊ÷ Ô²ÑæÊÜêdèèszâYüÞX„|ËÑèü¼Y$ŒÊˬŠíË´²ÊÑý°íÑ´æ®–£')Ð˪®ËÑèÄ…YË ñXÑ4÷X¹¬þý·´‚´Ä5–9
=Ž|¹·Ë¾g)üŒg2ÀÓË\­g½î˺ ËŸg �,•g X]Û|¹·Ëâh.ü hBëÖË\ÑhèïËå Ë4»h �L­h XŹ·ËÞþ‚Ñ,Õj4Üj|±k
m
×#)4ÏklÏk ,Ök

 
*m
Ò!ÑËY KS Ûk
  æk ìk
ík))6>3üÀi­üÐj�.ÓË\ûj+îË(ŸË¼ðjgÓÑd”kdîÑa<ŸÑĉk ²
ÒiÓLÈiËÒÑÇËfÑ4ɲ
‡Ñ¢Ý—Ë—P®&–êÔÛÑnËtü£m& m
ýb £mm
°²mü¥m$Jdæm¹·Ë" Åbü£mPm
ß_°mÆ#<Ýmmä×m òmü£mfm
æ_hD�n Žn�n8üäl«vÓË\çmsîËpã \�m¾,ëlñ
òl Ó_Ó_ DebugStructÁÖ_á»_×_Š »_Ø_
has_fieldsÁ»_ÿÖ!½¢—ÑM>ƒ&Û…&ã˜$”²¸š¹žï®#²˜$͵$•‚%N 9ûºÍ0áÜ0¦_÷ \ò0É÷ ÊÅd�1–¡,ª1¢!DerefMutÁD±1¯! ° Å1ž
Ú,±<üò…ütEB A scope guard will run a given closure when it goes out of scope,Áüº$! even if the code between panics.Áüß$! (as long as panic doesn't abort)Á„ˆtˆ # ExamplesÁ—ˆ”› ## Hello WorldÁ®ˆü²@= This example creates a scope guard with an example function:Áóˆ<÷ ```Áäÿ extern crate scopeguard;Áœˆd  fn f() {Áü­0- let _guard = scopeguard::guard((), |_| {ÁüÞ*' println!("Hello Scope Exit!");Á\‰ });Á•ˆü™! // rest of the code here.Á»ˆü¿OL // Here, at the end of `_guard`'s scope, the guard's closure is called.Áü�MJ // It is also called if we exit this scope through unwinding instead.Á,Ý }ÁŒã # fn main() {Álõ
# f();Á<ƒ # }Á<‹ƒ+“ˆ|— ## `defer!`Á§ˆü«<9 Use the `defer` macro to run an operation at scope exit,Áüè?< either regular scope exit or during unwinding from a panic.Á¨ˆ<¬ƒ+ü´0- #[macro_use(defer)] extern crate scopeguard;ÁåˆÄé use std::cell::Cell;Á‚ˆ|† fn main() {Áü–QN // use a cell to observe drops during and after the scope guard is activeÁüè(% let drop_counter = Cell::new(0);ÁL‘  {Áü› HE // Create a scope guard using `defer!` for the current scopeÁ¤ä  defer! {Áüù 96 drop_counter.set(1 + drop_counter.get());Ál³
}ÁÁ
ˆüÅ
:7 // Do regular operations here in the meantime.Á€ ˆü„ 96 // Just before scope exit: it hasn't run yet.Áü¾ .+ assert_eq!(drop_counter.get(), 0);Áí ˆüñ KH // The following scope end is where the defer closure is calledÁL½  }ÁüÇ *' assert_eq!(drop_counter.get(), 1);Á,ò Î.<ø ƒ+€
ˆì„
 ## Scope Guard with ValueÁ¢
ˆü¦
JG If the scope guard closure needs to access an outer value that is alsoÁüñ
PM mutated outside of the scope guard, then you may want to use the scope guardÁüÂNK with a value. The guard works like a smart pointer, so the inner value canÁü‘52 be accessed by reference or by mutable reference.ÁLjüË  ### 1. The guard owns a fileÁìˆüðOL In this example, the scope guard owns a file and ensures pending writes areÁÌÀ synced at scope exit.ÁÚˆ<Þƒ+äæ“+ƒˆœ‡ use std::fs::*;Áü› use std::io::{self, Write};Áü»96 # // Mock file so that we don't actually write a fileÁ´õ # struct MockFile;Á¬Œ # impl MockFile {Áü¢B? # fn create(_s: &str) -> io::Result<Self> { Ok(MockFile) }ÁüåEB # fn write_all(&self, _b: &[u8]) -> io::Result<()> { Ok(()) }Áü«96 # fn sync_all(&self) -> io::Result<()> { Ok(()) }Á<åŒ/üí! # use self::MockFile as File;Á�ˆü“%" fn try_main() -> io::Result<()> {Áü¹-* let f = File::create("newfile.txt")?;Áüç1. let mut file = scopeguard::guard(f, |f| {Áü™63 // ensure we flush file at return or panicÁüÐ! let _ = f.sync_all();Á\òÇ,üþ96 // Access the file through the scope guard itselfÁü¸0- file.write_all(b"test me\n").map(|_| ())Á,éÎ.ïˆ|óò1äƒ try_main().unwrap();Á, Î.¦ˆ<ªƒ+²ˆü¶85 ### 2. The guard restores an invariant on scope exitÁïˆ<óƒ+äû“+˜ˆüœ use std::mem::ManuallyDrop;ÁŒ¼ use std::ptr;ÁΈüÒDA // This function, just for this example, takes the first elementÁü—A> // and inserts it into the assumed sorted tail of the vector.Á4Ù //ÁüàKH // For optimization purposes we temporarily violate an invariant of theÁü¬-* // Vec, that it owns all of its elements.Á4ÚÅGüáJG // The safe approach is to use swap, which means two writes to memory,Áü¬RO // the optimization is to use a “holeâ€� which uses only one write of memoryÁüÿ" // for each position it moves.Á4¢ÅGü©>; // We *must* use a scope guard to run this code safely. WeÁüèMJ // are running arbitrary user code (comparison operators) that may panic.Áü¶HE // The scope guard ensures we restore the invariant after successfulÁüÿ+( // exit or during unwinding from panic.Áü«.+ fn insertion_sort_first<T>(v: &mut Vec<T>)ÁÜÚ where T: PartialOrdÁ,ö {Áüü  struct Hole<'a, T: 'a> {Áô� v: &'a mut Vec<T>,Á̼ index: usize,ÁüÖ# value: ManuallyDrop<T>,ÁLú©7„ ˆ„ˆ
unsafe {Áü™ HE // Create a moved-from location in the vector, a “holeâ€�.Áüâ )& let value = ptr::read(&v[0]);ÁüŒ!TQ let mut hole = Hole { v: v, index: 0, value: ManuallyDrop::new(value) };Áá!ˆüå!.+ // Use a scope guard with a value.Áü”"GD // At scope exit, plug the hole so that the vector is fullyÁüÜ"! // initialized again.Áüþ"UR // The scope guard owns the hole, but we can access it through the guard.ÁüÔ#A> let mut hole_guard = scopeguard::guard(hole, |hole| {Áü–$SP // plug the hole in the vector with the value that was // taken outÁüê$'$ let index =
Úbĸ0rD×0„Äå0—´ƒ1½ÜŸ1ÐÐëëDÀ1þ”‰2üË1=: Controls in which cases the associated code should be runÁD“2  ä³ü‰2« ÚfÚf  Äš3ü¢2=: Return `true` if the guard’s associated code should runÁüä21. (in the context where this method is called).ÁT�3 
âfÄî7è ¼£8T¦8

”¤<üó:0- Macro to create a `ScopeGuard` (always run).Á¤;ˆü¨;?< The macro takes statements, which are the body of a closureÁüè;+( that will run when the scope is exited.Á(|”< ·< Ž= ½< Ç<, ¾< ¿< Å<, À<8tÁ Á<& Â<8¢Ã<
Æ<*É< Ì< ‹= 8Ö<8_guardÁ4Ú< á<, ã<8,ä<'é<8ð,ë< ð< „= ñ< ò<$ ó< õ< ö< ÷< ø< ú< ƒ=, ü< ý< €=, þ<8˜j ÿ<
�=% …=% Œ=üðG'ü¦CA> `ScopeGuard` is a scope guard that may own a protected value.ÁèCˆüìC=: If you place a guard in a local variable, the closure canÁüªDNK run regardless how you leave the scope — through regular return or panicÁüùDJG (except if panic or other code aborts; so as long as destructors run).ÁÄÄE It is run only once.ÁÝEˆüáEIF The `S` parameter for [`Strategy`](trait.Strategy.html) determines ifÁô«F the closure actually runs.ÁÊFˆüÎFMJ The guard's closure will be called with the held value in the destructor.ÁœGˆü GOL The `ScopeGuard` implements `Deref` so that you can access the inner value.ÁTûG÷ÿ‡ã³Ë †Hã³Ñ ‰Hã³×TŒHÏ!ÑÝL¥HÑÝÑ!²
 ×D·H�')Ð˪®3rtoql ŒHè´ÇH,ÇH¹¼ãH4ãHþüÔI!DÔIé
üúIJ÷ÿ‡ÑsL©JŸs ‚J¯s …J¿s�s ÿIãsD»J�248:üºL<üËJLI Create a `ScopeGuard` that owns `v` (accessible through deref) and callsÁüœK&# `dropfn` when its destructor runs.ÁÇKˆüÏKHE The `Strategy` decides whether the scope guard's closure should run.Á.\ªLlÁLËÑ�
ËÑ×Ä*–3üâS#üžNMJ “Defuseâ€� the guard and extract the value without calling the closure.ÁðNˆ<øNƒ+ä„O“+¥Oˆü­O(% use scopeguard::{guard, ScopeGuard};ÁÚOˆüâO%" fn conditional() -> bool { true }ÁŒPˆ|”Pò1ü¨P=: let mut guard = guard(Vec::new(), |mut v| v.clear());Á´êP guard.push(1);Á…QˆÔ�Q if conditional() {Áü¬Q30 // a condition maybe makes us decide toÁüäQB? // “defuseâ€� the guard and get back its inner partsÁü«R63 let value = ScopeGuard::into_inner(guard);Á„æR
} else {ÁüûR0- // guard still exists in this branchÁL°S©7,¾SÎ.<ÈSƒ+TéS�Ë
ËÑ×ðœ
üÞXWüûWLI Create a new `ScopeGuard` owning `v` and with deferred closure `dropfn`.Á.\ÒX,åXËѨ÷ÿ�s ëXŸs îX¿sL«YÑs
ËÑÄø –
/157ü®eg÷!ÿ"‡#!"#ÑsLúeŸs ½e¯s ÀeÄË$íe¿s$�s ºeãsDŒf�=?CEü›fT÷%ÿ&‡'&'%ÑsLÔfŸs £f¯s ¦f¿s�s  fãsDæf�()£!¤!)=?CE\öf4ûf$$ˬŒg,�g< <� <Ë$ •g$
)ËÑ×$–güÂgW÷+ÿ,‡-,+-ÑsLþgŸs Êg¯s Íg¿s�s ÇgãsD�h�.°!.79=?ü h!L£h= =� =Ë* ­h*
.ËÑ×$²hüæhS÷0ÿ1‡2120ÑsLžiŸs îh¯s ñh¿s�s ëhãsD°i�3Æ!379=?”Ài$Ãi> >�²
/ Èi/
3ËÑ×$Íiüñkl÷5ÿ6‡7567ÑsLÂlŸs ùk¯s ükÅbËT¯l¿s$�s ökãsDÔl�8Æb8FHLNüäl4çl?@A ?� @¦b¦b•¨b°