This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| extern crate hyper; | |
| extern crate rustc_serialize; | |
| extern crate url; | |
| use rustc_serialize::json::Json; | |
| use url::Url; | |
| use std::io::Read; | |
| use hyper::Client; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #![feature(io)] | |
| use std::io::{stdin,Read}; | |
| fn translate(ch: char) -> char { | |
| match ch { | |
| ' ' => '█', | |
| '█' => ' ', | |
| '▀' => '▄', | |
| '▄' => '▀', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use std::io::stdin; | |
| fn main() { | |
| let mut line = String::new(); | |
| loop { | |
| let n_read = stdin().read_line(&mut line).unwrap(); | |
| println!("n_read: {}", n_read); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package wt2.notes.util; | |
| import java.util.function.Supplier; | |
| import java.util.NoSuchElementException; | |
| import java.util.Optional; | |
| public abstract class Result<T, E> { | |
| public static <T, E> Ok<T, E> Ok(T value) { | |
| return new Ok<T, E>(value); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| extern crate cidr; | |
| extern crate bitstring; | |
| use cidr::{Ipv4Cidr,Cidr}; | |
| use bitstring::BitString; | |
| fn main() { | |
| let ip = "10.61.3.123".parse().unwrap(); | |
| let mut net = Ipv4Cidr::new_host(ip); | |
| net.clip(24); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| extern crate cidr; | |
| use cidr::{Ipv4Inet,Inet}; | |
| fn main() { | |
| let ip = "10.61.3.123".parse().unwrap(); | |
| let ip = Ipv4Inet::new(ip, 24).unwrap(); | |
| println!("{}", ip.network()); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| uniforms { | |
| projection: [4; fvec4] | |
| } | |
| inputs { | |
| inpos, | |
| inclr | |
| } | |
| outputs { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let mut head = Node::new(vec[0].clone()); | |
| let mut current_head: &mut Node<T> = &mut head; | |
| for &next in &vec[1..] { | |
| let moved_head = current_head; // Takes the mutable reference away from current_head | |
| moved_head.right = Some(Box::new(Node::new(next.clone()))); | |
| current_head = moved_head.right.as_mut().unwrap(); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| struct OptionIter<I> { | |
| iter: Option<I>, | |
| } | |
| impl<I> Iterator for OptionIter<I> | |
| where | |
| I: Iterator, | |
| { | |
| type Item = Option<I::Item>; |