MCPcopy Create free account
hub / github.com/LibertyOS-Development/kernel / readchar

Method readchar

src/io/stdin.rs:29–41  ·  view source on GitHub ↗

Read character

(&self)

Source from the content-addressed store, hash-verified

27
28 // Read character
29 pub fn readchar(&self) -> Option<char>
30 {
31 let mut buffer = vec![0; 4];
32 if let Some(bytes) = crate::sys::sc::read(0, &mut buffer)
33 {
34 if bytes > 0
35 {
36 buffer.resize(bytes, 0);
37 return Some(String::from_utf8_lossy(&buffer).to_string().remove(0));
38 }
39 }
40 None
41 }
42
43
44 // Read line

Callers 1

inputMethod · 0.80

Calls 1

readFunction · 0.50

Tested by

no test coverage detected