MCPcopy Create free account
hub / github.com/csskit/csskit / flush

Method flush

crates/css_parse/src/cursor_ordered_sink.rs:33–42  ·  view source on GitHub ↗

Flush all remaining buffered cursors to the delegate sink in source order. This is typically called when no more cursors will be added.

(&mut self)

Source from the content-addressed store, hash-verified

31 /// Flush all remaining buffered cursors to the delegate sink in source order.
32 /// This is typically called when no more cursors will be added.
33 pub fn flush(&mut self) {
34 self.buffer.sort_by_key(|cursor| cursor.span().start());
35 for cursor in self.buffer.iter() {
36 self.sink.append(*cursor);
37 }
38 if let Some(last_cursor) = self.buffer.last() {
39 self.committed_position = last_cursor.end_offset();
40 }
41 self.buffer.clear();
42 }
43}
44
45impl<'a, S: CursorSink> CursorSink for CursorOrderedSink<'a, S> {

Callers 4

writeMethod · 0.80
appendMethod · 0.80
test_basicFunction · 0.80
test_manual_flushFunction · 0.80

Calls 6

iterMethod · 0.80
end_offsetMethod · 0.80
clearMethod · 0.80
startMethod · 0.45
spanMethod · 0.45
appendMethod · 0.45

Tested by 2

test_basicFunction · 0.64
test_manual_flushFunction · 0.64