(1..13).map(fib).collect::<Vec<i32>>()
[2, 2, 4, 6, 10, 16, 26, 42, 68, 110, 178, 288]
let values = (1..13).map(fib).collect::<Vec<i32>>();
values
[2, 2, 4, 6, 10, 16, 26, 42, 68, 110, 178, 288]
use std::sync::{Mutex, Arc};
let counter = Arc::new(Mutex::new(0i32));
std::thread::spawn({
    let counter = Arc::clone(&counter);
    move || {
        for i in 1..300 {
            *counter.lock().unwrap() += 1;
            std::thread::sleep(std::time::Duration::from_millis(100));
        }
}});
*counter.lock()?
209
*counter.lock()?
288
*counter.lock()?
299
:dep base64 = "0.10.1"
base64::encode(&vec![1, 2, 3, 4])
"AQIDBA=="
pub fn fib(x: i32) -> i32 {
    if x <= 2 {2} else {fib(x - 2) + fib(x - 1)}
}
use std::fmt::Debug;
pub struct Matrix<T> {pub values: Vec<T>, pub row_size: usize}
impl<T: Debug> Matrix<T> {
    pub fn evcxr_display(&self) {
        let mut html = String::new();
        html.push_str("<table>");
        for r in 0..(self.values.len() / self.row_size) {
            html.push_str("<tr>");
            for c in 0..self.row_size {
                html.push_str("<td>");
                html.push_str(&format!("{:?}", self.values[r * self.row_size + c]));
                html.push_str("</td>");
            }
            html.push_str("</tr>");            
        }
        html.push_str("</table>");
        println!("EVCXR_BEGIN_CONTENT text/html\n{}\nEVCXR_END_CONTENT", html);
    }
}
let m = Matrix {values: vec![1,2,3,4,5,6,7,8,9], row_size: 3};
m
1 2 3
4 5 6
7 8 9
extern crate image;
extern crate base64;
pub trait EvcxrResult {fn evcxr_display(&self);}
impl EvcxrResult for image::RgbImage {
    fn evcxr_display(&self) {
        let mut buffer = Vec::new();
        image::png::PNGEncoder::new(&mut buffer).encode(&**self, self.width(), self.height(),
            image::ColorType::RGB(8)).unwrap();
        let img = base64::encode(&buffer);
        println!("EVCXR_BEGIN_CONTENT image/png\n{}\nEVCXR_END_CONTENT", img);        
    }
}
impl EvcxrResult for image::GrayImage {
    fn evcxr_display(&self) {
        let mut buffer = Vec::new();
        image::png::PNGEncoder::new(&mut buffer).encode(&**self, self.width(), self.height(),
            image::ColorType::Gray(8)).unwrap();
        let img = base64::encode(&buffer);
        println!("EVCXR_BEGIN_CONTENT image/png\n{}\nEVCXR_END_CONTENT", img);        
    }
}
            image::ColorType::RGB(8)).unwrap();
                              ^^^ variant or associated item not found in `image::ColorType`
no variant or associated item named `RGB` found for type `image::ColorType` in the current scope
            image::ColorType::Gray(8)).unwrap();
                              ^^^^ variant or associated item not found in `image::ColorType`
no variant or associated item named `Gray` found for type `image::ColorType` in the current scope
image::ImageBuffer::from_fn(256, 256, |x, y| {
    if (x as i32 - y as i32).abs() < 3 {
        image::Rgb([0, 0, 255])
    } else {
        image::Rgb([0, 0, 0])
    }
})
:dep tokio = {version = "0.2", features = ["full"]}
let mut stream : tokio::net::TcpStream = tokio::net::TcpStream::connect("127.0.0.1:99999").await?;
invalid port value
let mut stream : tokio::net::TcpStream = tokio::net::TcpStream::connect("127.0.0.1:6573").await?;
Connection refused (os error 111)
use tokio::io::AsyncWriteExt;
stream.write(b"Hello, world!\n").await?;
stream.write(b"Hello, world!\n").await?;
^^^^^^ not found in this scope
cannot find value `stream` in this scope
:vars
</table> </div> </div> </div> </div> </div>
:help
:vars             List bound variables and their types
:opt [level]      Toggle/set optimization level
:fmt [format]     Set output formatter (default: {:?}). 
:efmt [format]    Set the formatter for errors returned by ?
:explain          Print explanation of last error
:clear            Clear all state, keeping compilation cache
:dep              Add dependency. e.g. :dep regex = "1.0"
:sccache [0|1]    Set whether to use sccache.
:linker [linker]  Set/print linker. Supported: system, lld
:version          Print Evcxr version
:preserve_vars_on_panic [0|1]  Try to keep vars on panic

Mostly for development / debugging purposes:
:last_compile_dir Print the directory in which we last compiled
:timing           Toggle printing of how long evaluations take
:last_error_json  Print the last compilation error as JSON (for debugging)
:time_passes      Toggle printing of rustc pass times (requires nightly)
:internal_debug   Toggle various internal debugging code
let _immutable_binding = 1;
let mut mutable_binding = 1;

println!("Before mutation: {}", mutable_binding);

// Ok
mutable_binding += 1;

println!("After mutation: {}", mutable_binding);
_immutable_binding += 1;
let _immutable_binding = 1;
    ^^^^^^^^^^^^^^^^^^ first assignment to `_immutable_binding`
_immutable_binding += 1;
^^^^^^^^^^^^^^^^^^^^^^^ cannot assign twice to immutable variable
cannot assign twice to immutable variable `_immutable_binding`
</div>
Variable Type
m Matrix<i32>
counter std::sync::Arc<std::sync::Mutex<i32>>
values std::vec::Vec<i32>