Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- use std::io::{Result, Error};
- fn main() {
- let vec: Vec<Result<()>> = vec![];
- let val: Result<Vec<()>> = vec.iter().collect();
- println!("{:?}", val);
- }
- //pub fn vec() -> Vec<u32> {
- // (0..).take(1024 * 32).collect()
- //}
- /*const length: usize = 1024 * 32;
- pub fn slice() -> [u32; length] {
- (0..)
- .zip(0..length)
- .fold([0; length], |mut acc, (num, idx)| {
- acc[idx] = num;
- acc
- })
- } */
- /* use delegate;
- // The `delegate::setup!(...)` call is only a data container
- #[delegate::gen]
- delegate::setup!(NetworkHandler<T>, {
- Network {
- send -> ( &self, &[u8] ) => inner,
- receive -> ( &self ) -> (usize, &[u8]) => inner,
- }
- });
- /*
- * Let's look at what information is required to generate the following code
- */
- // T is taken from NetworkHandler<T> parsing
- impl<T> Network for NetworkHandler<T> {
- // &self is magic
- // -> basically &self, self and &mut self are parsed seperately
- // and are not included in the parameter list of the called function
- // all other parameters get an id assigned (here `a`)
- fn send(&self, a: &[u8]) {
- self.inner.send(a) // Call function with only id names
- }
- // Again, self is magic
- fn receive(&self) -> (usize, &[u8]) {
- self.inner.receive()
- }
- }
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement