From 6ee5e1684b10853d5dcd3495e5e3aac5c569e45e Mon Sep 17 00:00:00 2001 From: debris Date: Mon, 30 Nov 2015 11:29:30 +0100 Subject: [PATCH] rename try_to_finish -> note_appended --- src/rlp.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/rlp.rs b/src/rlp.rs index 27151295f..846281a2b 100644 --- a/src/rlp.rs +++ b/src/rlp.rs @@ -559,7 +559,7 @@ impl RlpStream { object.encode(&mut self.encoder); // if list is finished, prepend the length - self.try_to_finish(1); + self.note_appended(1); // return chainable self self @@ -586,7 +586,7 @@ impl RlpStream { 0 => { // we may finish, if the appended list len is equal 0 self.encoder.bytes.push(0xc0u8); - self.try_to_finish(1); + self.note_appended(1); } _ => self.unfinished_lists.push_back(ListInfo::new(position, len)), } @@ -613,7 +613,7 @@ impl RlpStream { self.encoder.bytes.push(0x80); // try to finish and prepend the length - self.try_to_finish(1); + self.note_appended(1); // return chainable self self @@ -625,7 +625,7 @@ impl RlpStream { self.encoder.bytes.extend(bytes); // try to finish and prepend the length - self.try_to_finish(item_count); + self.note_appended(item_count); // return chainable self self @@ -652,7 +652,7 @@ impl RlpStream { /// Streams out encoded bytes. /// - /// Returns an error if stream is not finished. + /// panic! if stream is not finished. pub fn out(self) -> Vec { match self.is_finished() { true => self.encoder.out(), @@ -660,8 +660,8 @@ impl RlpStream { } } - /// try to finish lists - fn try_to_finish(&mut self, inserted_items: usize) -> () { + /// Try to finish lists + fn note_appended(&mut self, inserted_items: usize) -> () { let should_finish = match self.unfinished_lists.back_mut() { None => false, Some(ref mut x) => { @@ -677,7 +677,7 @@ impl RlpStream { let x = self.unfinished_lists.pop_back().unwrap(); let len = self.encoder.bytes.len() - x.position; self.encoder.insert_list_len_at_pos(len, x.position); - self.try_to_finish(1); + self.note_appended(1); } } }