Skip to content
Snippets Groups Projects
Commit c1886010 authored by Georgy Moshkin's avatar Georgy Moshkin :speech_balloon: Committed by Georgy Moshkin
Browse files

chore: move mod tests to the end of file

parent 90b13fbd
No related branches found
No related tags found
1 merge request!302feat(notify): print expected and actual type names on downcast error
......@@ -353,6 +353,22 @@ pub const fn str_eq(lhs: &str, rhs: &str) -> bool {
}
}
////////////////////////////////////////////////////////////////////////////////
/// Return terminal screen size in rows, columns.
pub fn screen_size() -> (i32, i32) {
let mut rows = std::mem::MaybeUninit::uninit();
let mut cols = std::mem::MaybeUninit::uninit();
unsafe {
rl_get_screen_size(rows.as_mut_ptr(), cols.as_mut_ptr());
return (rows.assume_init() as _, cols.assume_init() as _);
}
use std::os::raw::c_int;
extern "C" {
pub fn rl_get_screen_size(rows: *mut c_int, cols: *mut c_int);
}
}
#[cfg(test)]
mod tests {
#[test]
......@@ -383,19 +399,3 @@ mod tests {
assert!(!str_eq("foo1", "foo2"));
}
}
////////////////////////////////////////////////////////////////////////////////
/// Return terminal screen size in rows, columns.
pub fn screen_size() -> (i32, i32) {
let mut rows = std::mem::MaybeUninit::uninit();
let mut cols = std::mem::MaybeUninit::uninit();
unsafe {
rl_get_screen_size(rows.as_mut_ptr(), cols.as_mut_ptr());
return (rows.assume_init() as _, cols.assume_init() as _);
}
use std::os::raw::c_int;
extern "C" {
pub fn rl_get_screen_size(rows: *mut c_int, cols: *mut c_int);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment