• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

lpenz / ogle / 13740103149

08 Mar 2025 06:02PM UTC coverage: 57.389% (-0.04%) from 57.426%
13740103149

push

github

lpenz
Use enum_dispatch for Output and SysApi

4 of 7 new or added lines in 5 files covered. (57.14%)

233 of 406 relevant lines covered (57.39%)

1.55 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

50.0
/src/sys_api.rs
1
// Copyright (C) 2025 Leandro Lisboa Penz <lpenz@lpenz.org>
2
// This file is subject to the terms and conditions defined in
3
// file 'LICENSE', which is part of this source code package.
4

5
use enum_dispatch::enum_dispatch;
6

7
use color_eyre::Result;
8
use mockall::automock;
9

10
use crate::sys_real::SysReal;
11
use crate::time_wrapper::Instant;
12

13
#[enum_dispatch]
14
#[derive(Debug)]
15
pub enum Sys {
16
    SysReal,
17
    MockSysApi,
18
}
19

NEW
20
#[enum_dispatch(Sys)]
×
21
#[automock]
32✔
22
pub trait SysApi: std::fmt::Debug {
23
    fn now(&self) -> Instant;
24
    fn width(&self) -> usize;
25
    fn log_line(&mut self, line: &str) -> Result<()>;
26
    fn update_status(&mut self, status: &str) -> Result<()>;
27
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc