You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
612 B
22 lines
612 B
use std::iter; |
|
|
|
/// Create an empty vector |
|
pub fn create_empty() -> Vec<u8> { |
|
Vec::new() |
|
} |
|
|
|
/// Create a buffer of `count` zeroes. |
|
/// |
|
/// Applications often use buffers when serializing data to send over the |
|
/// network. |
|
pub fn create_buffer(count: usize) -> Vec<u8> { |
|
iter::repeat(0).take(count).collect() |
|
} |
|
|
|
/// Create a vector containing the first five elements of the Fibonacci sequence. |
|
/// |
|
/// Fibonacci's sequence is the list of numbers where the next number is a sum of the previous two. |
|
/// Its first five elements are `1, 1, 2, 3, 5`. |
|
pub fn fibonacci() -> Vec<u8> { |
|
vec![1, 1, 2, 3, 5] |
|
}
|
|
|