Skip to content

Commit

Permalink
Remove use of #![feature(collections)] from the symmetriccipher example
Browse files Browse the repository at this point in the history
Replacement for push_all() suggested by @fotcorn on Github.
  • Loading branch information
Palmer Cox committed Apr 4, 2015
1 parent 9d087d0 commit b6e3294
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions examples/symmetriccipher.rs
Expand Up @@ -4,8 +4,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![feature(collections)]

extern crate crypto;
extern crate rand;

Expand Down Expand Up @@ -63,7 +61,7 @@ fn encrypt(data: &[u8], key: &[u8], iv: &[u8]) -> Result<Vec<u8>, symmetricciphe
// from the writable buffer, create a new readable buffer which
// contains all data that has been written, and then access all
// of that data as a slice.
final_result.push_all(write_buffer.take_read_buffer().take_remaining());
final_result.extend(write_buffer.take_read_buffer().take_remaining().iter().map(|&i| i));

match result {
BufferResult::BufferUnderflow => break,
Expand Down Expand Up @@ -95,7 +93,7 @@ fn decrypt(encrypted_data: &[u8], key: &[u8], iv: &[u8]) -> Result<Vec<u8>, symm

loop {
let result = try!(decryptor.decrypt(&mut read_buffer, &mut write_buffer, true));
final_result.push_all(write_buffer.take_read_buffer().take_remaining());
final_result.extend(write_buffer.take_read_buffer().take_remaining().iter().map(|&i| i));
match result {
BufferResult::BufferUnderflow => break,
BufferResult::BufferOverflow => { }
Expand Down

0 comments on commit b6e3294

Please sign in to comment.