SH
Size: a a a
ИЛ
D
use std::fs;
pub fn get_kernel() -> String {
return match fs::read_to_string("/proc/version") {
Ok(value) => match value.split_whitespace().nth(2) {
Some(value) => value.to_string(),
None => panic!("Could not parse a kernel version :(")
}
Err(_e) => panic!("Could not read proc/sys/kernel/hostname :(")
};
}
Так же нельзя? Я чувствую что это оч плохоMB
MB
D
D
D
AK
use std::fs;
pub fn get_kernel() -> String {
return match fs::read_to_string("/proc/version") {
Ok(value) => match value.split_whitespace().nth(2) {
Some(value) => value.to_string(),
None => panic!("Could not parse a kernel version :(")
}
Err(_e) => panic!("Could not read proc/sys/kernel/hostname :(")
};
}
Так же нельзя? Я чувствую что это оч плохо
fs::read_to_string(path).ok().and_then(|val| val.split_whitrspace().nth(2)).map(st::str::to_string).expect("Error reading path")
SS
АГ
JC
JC
SL
M
match self.prop {
1=>...,
2=>...,
}
M
A
YK