Files
boc/aamos-ledger-rust/target/debug/deps/libscopeguard-ccb5054c1d5044be.rlib
T

85 lines
27 KiB
Plaintext
Raw Normal View History

!<arch>
/ 0 0 0 0 8 `
// 70 `
scopeguard-ccb5054c1d5044be.scopeguard.c0a28c330e6ea90e-cgu.0.rcgu.o/
lib.rmeta/ 0 0 0 644 26328 `
ELF·Xe@@GNUÀrust
c#rustc 1.96.0 (ac68faa20 2026-05-25)ÁíàÄTËŸ ÜJîÄ)'ß\¥!-3d1337db07d0b3aeÁ¤°ð ¾ä-±($²ï=©Ã-7e98a21bfd32b0edÁ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Á¥¤»dropfnÁstrategyÁ¥¤
with_strategyÁ
into_innerÁ£¥ ¥  ¤$¥$$¤$å$´*¥**¤*/¥//¤/ã4¥44¤4×AlwaysÁ:×)
.
3
8
8
8
;
;
;
 ¿c9ýÙ´:b‹ à æ» -´ë³N7ž¥¤é!ö!Œ"¿c:94
9 $*/¿c# 
 é!ö!Œ"(5;Ö¿Ù¿Ú¿«Û¿ˆÜ¿Ý¿Þ¿ˆ‚†f|Â
ŸÈŸÈ ÈErrorÁ O˜éBL à¡  c cˆ¢cµ
 `£cbufÁ `àB¤GS
çð±ý$Å8
Ï8ü£8,$¶8¤¡M
(Œ¡M
¼Ã ³ML4ÝM
ÌËMŒËM
¼É<$üM ÃÉÏ PhantomDataÁFu\»ŸÏϘNüºLÞ —N3œãLà ÏLÉ4ÕLÃÛÃÛ ManuallyDropÁÅÛ»¬µÜÀ,%*ÞÃÛÃÛŽÅÛ»¬µÜÀ,%*ÉfÉÒÁ¡¥ÿÙ ¤
¥É Ä“UŒ“U
¼,¥U%,âU\âU
ë!ÃÛÃÛŽÅÛ»¬µÜÀ,%*YQUdáU
ë! làUÄÖULÖU
ÝÃ*",ÇW dÇW
÷! ) !ŒÂW
 Çü¯W%”¯W
ÁÉ
2 %,âW÷W ðWüâS•üƒUôüÊU§
à „T,ôSL‡UÃ,ÎU Ã, Ã[ Î Ù ô©
Þ Çþ - I£{£»ÔÝxEûã±µæ¥OÃü¼Y$̼Y
ÃÉà ÖY4ÙY2âYüÞX„æ» -´ë³N7žÃÉàÄ…Yà ñXÉ4÷XÁˆˆØT®g\­gû'¾g)üŒg2ÄŸgÚ,•gÏd3ûkTÒh\Ñh
÷!. âh.ü hB Ã4»hL­h q9ˆwüæj> Tüj\ûjû'dúj¼ðjLðj±$\•k Çd”k
ë!Ç -  !l“k
 ĉkL‰k
ÝÉ
*  #üïj3  ,Õj
Ã4Üj
É|±kl±k
Ï
$
4Ïk
,Ök
lÏk T
™"ÉÃj1: ìk
$ 2:íkP  ¡k üÀi­~
Ž 
­
½ 
3jüÐj©
ÒiLÈiÃûÉàÃÉûºÓÄùÏÉq É É» ÇÛ©
®Éôè¾Ã夻£ŒN û±l©=àãß(ÃŽÉôÃúÉð²m 
ü£m&d¥m
÷c £m:ü¥m$0<Ým
¨"Tèm
\çmû
' dæm ¿cü£mP,×m
Ù`¾Dä×mü£mf4n
à`RDnn8üäl« Û \mÚ,ëlè
òl Í`Í` DebugStructÁÐ`×µ`Ñ` µ`Ò`
has_fieldsÁµ`ã¹q·Ù›ß¨úé$£ë$«¨"̨"~Â#?Äeϲ±á¾"ýûÄÂ#à#o–$? 9íÀÍ0×Ü0 `ò \ò0ò Žd1ÃÛr,ª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() {Á
# 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());Á
Á
úüÅ
: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Á üÇ *' 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.ÁÇúüË  ### 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(|_| ())ÁÃ-ïúç0äƒ 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.Á //ÁüàKH // For optimization purposes we temporarily violate an invariant of theÁü¬-* // Vec, that it owns all of its elements.ÁºFüá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.ÁºFü©>; // 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>,Áž6ú„ˆ
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 =
Ú×ĸ0çD×0ùÄå0 ´ƒ12DŸ1EE``DÀ1s”‰2üË1=: Controls in which cases the associated code should be runÁD“2  Îìü‰2« ÏeÏe  Äš3ü¢2=: Return `true` if the guard’s associated code should runÁüä21. (in the context where this method is called).ÁT3