Debian Codegraph @

build/rust/terminal_size/lib.rs

raw
1 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
2 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
3 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
4 // option. This file may not be copied, modified, or distributed
5 // except according to those terms.
6
7 #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
8 pub struct Width(pub u16);
9 #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
10 pub struct Height(pub u16);
11
12 pub fn terminal_size() -> Option<(Width, Height)> {
13 Some((Width(80), Height(25)))
14 }
15
16 #[cfg(unix)]
17 pub fn terminal_size_using_fd(_fd: std::os::unix::io::RawFd) -> Option<(Width, Height)> {
18 Some((Width(80), Height(25)))
19 }
20
21 #[cfg(windows)]
22 pub fn terminal_size_using_handle(
23 _handle: std::os::windows::io::RawHandle,
24 ) -> Option<(Width, Height)> {
25 Some((Width(80), Height(25)))
26 }