MCPcopy Create free account
hub / github.com/astral-sh/ruff / drain_snapshot

Method drain_snapshot

crates/ruff_python_parser/src/parser/scratch_buffer.rs:64–71  ·  view source on GitHub ↗
(&mut self, mut snapshot: ScratchSnapshot)

Source from the content-addressed store, hash-verified

62
63 #[inline]
64 fn drain_snapshot(&mut self, mut snapshot: ScratchSnapshot) -> Drain<'_, T> {
65 debug_assert!(
66 self.buffer.len() >= snapshot.len,
67 "Scratch buffer snapshots must be restored in reverse order of creation."
68 );
69 snapshot.bomb.defuse();
70 self.buffer.drain(snapshot.len..)
71 }
72}
73
74impl<T> Drop for ScratchBuffer<T> {

Callers 2

takeMethod · 0.80
take_thin_vecMethod · 0.80

Calls 2

drainMethod · 0.80
defuseMethod · 0.45

Tested by

no test coverage detected