1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
use std::io::ErrorKind;
use crate::scanner_rust::generic_array::typenum::U48;
use crate::scanner_rust::{ScannerAscii, ScannerError};
#[inline]
pub fn get_kernel_version() -> Result<String, ScannerError> {
let mut sc: ScannerAscii<_, U48> = ScannerAscii::scan_path2("/proc/version")?;
sc.drop_next_bytes(14)?.ok_or(ErrorKind::UnexpectedEof)?;
let v = sc.next_raw()?.ok_or(ErrorKind::UnexpectedEof)?;
Ok(unsafe { String::from_utf8_unchecked(v) })
}