Files
boc/rust-service/target/release/deps/libscopeguard-14a1bf74f002cc8b.rmeta
T

68 lines
26 KiB
Plaintext
Raw Normal View History

rust
Ae#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<±pİÎ6 à æ» %94ŒŸŒp¥¤é!ö!Œ"¿c:94
9 $*/¿c# 
 é!ö!Œ"(5;Ö¿Ù¿Ú¿«Û¿ˆÜ¿Ý¿Þ¿ˆ‚†f|Â
ŸÈŸÈ ÈErrorÁ O˜éBL à¡  c cˆ¢cµ
 `£cbufÁ `àB¤GS
çð±ý$Å8Ï8ü£8,$¶8
¤¡MÍÑ4@…ùA ×ÛÃý»41@ ÃÛÃ
ë4@ÌËMQN ×ÛÉK ÃÛÉGüM‘ ÃÉÏ÷ PhantomDataÁFu\»ŸÏÏ ‘N˜NüºLÞýƒ4o@¼Ã2ý°_AàÃ?+¼É'àÉbœãLà ÏLÉ4ÕLÃÛÃÛ ManuallyDropÁÅÛ»¬µÜÀ,%*ÃÍÃÛÃÛ¼ÅÛ»¬µÜÀ,%*ɵ×Û×ÛØÛ
MaybeDanglingÁÚÛˆÙ @€y,¸·Â¦ÃI×Û×ÛØÛ¿ÚÛˆÙ @€y,¸·Â¦ÉÁ!É —N L‡UÊÈ ×ÛÆ ÃÛÃ,ÎUýàÕ%N ×Û×ÛØÛ¿ÚÛˆÙ @€y,¸·Â¦°®ÃåR@  ÎõùÉýÒR'@ æ
®ÉE$ ðWüâS•
øR@ ,âW2 öW÷W?üƒUôüÊU§¼Ä“UàKýâT9@Å\âUý”8AáEU@.ÅÃdáU*áÃ&ý¨ÃåNÝÃÄÖUýêVE@ÈdÇWýÙDA
âE¡W@
ý‰Pø@ÁÉü¯W%0 âÉEðR@ à „T,ôSÃÛÃÛ¼ÅÛ»¬µÜÀ,%*šÃZ©
sÎs É £f£Ó»ØÃôÐ$
£«´ ×ÛÃÉ ÃÛÃÆÄ«´ ×ÛÉÏ ÃÛÉëÇ ÃÉàdî Fu\»ŸààºÁâYüÞX„ÃÃÉàü¼Y$ӼãÑàëù¼Éô÷àɫ滠%94ŒŸŒpÃÉàÄ…Yà ñXÉ4÷X°£õô®«ù«Á59
É,=¿A°®Ã¾g)üŒg2ÒÅÃ\­gÏáÃÌ ÃŸg ,•g XA°®Ãâh.ü hBþÈÃ\ÑhûâÃø Ã4»h L­h X °®ÃõùÉ,Õj d4Üj d|±k
d
Ï$*
4Ïk dlÏk ,Ök
 d
. 
=d
™"ÉÃ ^g Ûk
  æk ìk
ík#  üÀi­?O _uu ƒ3lüÐj×ÅÃ\ûjÔáÃѬÝüðjÅÉd”k
áÉ
åÝÉĉk
©
ÒiLÈiÃiÉKÃfÉ4:©
äÉî ôÃô|ƒ^»Ë±|Ôžå Fà ¡kÉÌÃÒÉØÃÞü£m& d
÷c £md
°²mü¥m$JdæmÕ°®Ã" ¿cü£mPd
Ù`°dÂ%<Ýmmä×m òmü£mfd
à`hDn Žnn8üäl«@ ÅÃ\çm= áÃ: Û \m,ëlè
òl Í`Í` DebugStructÁÐ`×µ`Ñ` µ`Ò`
has_fieldsÁµ`ã¹q·Ù›ß¨>ÿ'Û(ã”&ö¸š±žïª%ö”&ͱ&þ&N 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);Á Ê0 ÿ,
úì„
 ## 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(()) }Áˆ1üí! # 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ïúî3äƒ try_main().unwrap();Á, Ê0¦úÿ,²úü¶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.ÁÁIüá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.ÁÁIü©>; // 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>,Á¥9ú„ˆ
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 =
Ú
^ĸ0nD×0Äå0´ƒ1¹DŸ1ÌÌççDÀ1ú”‰2üË1=: Controls in which cases the associated code should be runÁD“2  Îìü‰2« ÖhÖh  Äš3ü¢2=: Return `true` if the guard’s associated code should runÁüä21. (in the context where this method is called).ÁT3 
ÞhÄî7à ¼£8T¦8