MCPcopy Create free account
hub / github.com/bedroombuilds/python2rust / next

Method next

0d_files/rust/bufread_iterator.rs:40–62  ·  view source on GitHub ↗
(&mut self)

Source from the content-addressed store, hash-verified

38 type Item = io::Result<Rc<String>>;
39
40 fn next(&mut self) -> Option<Self::Item> {
41 let buf = match Rc::get_mut(&mut self.buf) {
42 Some(buf) => {
43 buf.clear();
44 buf
45 }
46 None => {
47 self.buf = new_buf();
48 Rc::make_mut(&mut self.buf)
49 }
50 };
51
52 self.reader
53 .read_line(buf)
54 .map(|u| {
55 if u == 0 {
56 None
57 } else {
58 Some(Rc::clone(&self.buf))
59 }
60 })
61 .transpose()
62 }
63 }
64}

Callers 4

user_connectedFunction · 0.45
mainFunction · 0.45
naive_capitalizeFunction · 0.45
ascii_capitalizeFunction · 0.45

Calls 2

new_bufFunction · 0.85
read_lineMethod · 0.80

Tested by

no test coverage detected