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

veeso / tui-realm-stdlib / 22147789116

09 Feb 2026 04:20PM UTC coverage: 77.303% (+4.8%) from 72.482%
22147789116

push

github

hasezoey
refactor(table): switch to use "CommonProps"

18 of 90 new or added lines in 1 file covered. (20.0%)

405 existing lines in 20 files now uncovered.

3944 of 5102 relevant lines covered (77.3%)

4.92 hits per line

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

44.44
/src/components/phantom.rs
1
use tuirealm::command::{Cmd, CmdResult};
2
use tuirealm::props::{AttrValue, Attribute, Props};
3
use tuirealm::ratatui::layout::Rect;
4
use tuirealm::{Frame, MockComponent, State};
5

6
/// [`Phantom`] is a component which is not rendered. It's only purpose is to become a global listener in a tui-realm application
7
/// for some kind of events using subscriptions.
8
///
9
/// An example would be a listener for `<ESC>` key to terminate the application.
10
/// The [`Phantom`] allows you not to write a listener for each component for the `ESC` key, but just to subscribe the phantom to it.
11
#[derive(Default)]
12
pub struct Phantom {
13
    props: Props,
14
}
15

16
impl MockComponent for Phantom {
UNCOV
17
    fn view(&mut self, _render: &mut Frame, _area: Rect) {}
×
18

UNCOV
19
    fn query(&self, attr: Attribute) -> Option<AttrValue> {
×
UNCOV
20
        self.props.get(attr)
×
UNCOV
21
    }
×
22

UNCOV
23
    fn attr(&mut self, attr: Attribute, value: AttrValue) {
×
UNCOV
24
        self.props.set(attr, value);
×
UNCOV
25
    }
×
26

27
    fn state(&self) -> State {
2✔
28
        State::None
2✔
29
    }
2✔
30

UNCOV
31
    fn perform(&mut self, _cmd: Cmd) -> CmdResult {
×
32
        CmdResult::None
×
33
    }
×
34
}
35

36
#[cfg(test)]
37
mod tests {
38

39
    use super::*;
40

41
    use pretty_assertions::assert_eq;
42

43
    #[test]
44
    fn test_components_phantom() {
2✔
45
        let component = Phantom::default();
2✔
46
        // Get value
1✔
47
        assert_eq!(component.state(), State::None);
2✔
48
    }
2✔
49
}
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