MCPcopy Create free account
hub / github.com/CodSpeedHQ/codspeed / new

Method new

src/local_logger/rolling_buffer/mod.rs:44–70  ·  view source on GitHub ↗
(title: &str)

Source from the content-addressed store, hash-verified

42
43impl RollingBuffer {
44 fn new(title: &str) -> Self {
45 let term = Term::stderr();
46 let (rows, cols) = term.size();
47 let rows = rows as usize;
48 let cols = cols as usize;
49
50 let active = *IS_TTY && rows >= 5;
51 // Reserve space for title + delimiters
52 let max_lines = if active {
53 20.min(rows.saturating_sub(6))
54 } else {
55 0
56 };
57
58 Self {
59 lines: VecDeque::with_capacity(max_lines),
60 max_lines,
61 total_lines: 0,
62 rendered_count: 0,
63 term,
64 term_width: cols,
65 active,
66 title: title.to_string(),
67 start: Instant::now(),
68 finished: false,
69 }
70 }
71
72 pub fn is_active(&self) -> bool {
73 self.active

Callers

nothing calls this directly

Calls 1

sizeMethod · 0.80

Tested by

no test coverage detected