This file contains 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
fn main() { | |
println!("Hello, world!"); | |
} |
This file contains 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 failure::Fail; | |
#[derive(Debug, Fail)] | |
#[fail(display = "Hello World")] | |
struct MyError; | |
fn main() { | |
let err: Result<(), MyError> = Err(MyError); | |
println!("{}", err.unwrap_err()); | |
} |
This file contains 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
#[macro_use] | |
extern crate failure; | |
use failure::Fail; | |
#[derive(Debug, Fail)] | |
#[fail(display = "my error")] | |
struct MyError; | |
#[derive(Debug, Fail)] |
This file contains 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 core; | |
extern crate html5ever; | |
#[macro_use] | |
extern crate string_cache; | |
#[macro_use] | |
extern crate tendril; | |
use html5ever::parse_document; | |
use html5ever::rcdom::{Element, Handle, RcDom}; |
This file contains 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
//does the monoid operation on the slice of tuples if the closure evaluates to true | |
fn accumulate<'a, T: Monoid>(tuples: &[(&'a str, &Fn(i32) -> bool)], i: i32) -> Option<T> | |
where &'a str: Into<T> { | |
tuples.iter() | |
.filter(|&&(_,include_fn)| include_fn(i)) | |
.map(first) | |
.fold(None, |acc, concat_str| acc.op(Some(concat_str.into()))) | |
} |
This file contains 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
//does the monoid operation on the slice of tuples if the closure evaluates to true | |
fn accumulate<'a, T: Monoid>(tuples: &[(&'a str, &Fn(i32) -> bool)], i: i32) -> Option<T> | |
where &'a str: Into<T> { | |
tuples.iter() | |
.filter(|&&(_,include_fn)| include_fn(i)) | |
.map(first) | |
.fold(None, |acc, concat_str| acc.op(Some(concat_str.into()))) | |
} |
This file contains 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
//! The `fizzbuzz` crate provides the way to get a customizable fizzbuzz implementation | |
//! | |
//! # Examples | |
//! | |
//! ``` | |
//! let mut acc = "".to_string(); | |
//! for i in 1..16 { | |
//! acc = acc + &*fizzbuzz::cowbuzz(&[ | |
//! ("Fizz", &|i: i32| i % 3 == 0), | |
//! ("Buzz", &|i: i32| i % 5 == 0), |
This file contains 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
//#include <cuda_runtime.h> | |
#include <cstring> | |
#include <cstdlib> | |
#include <vector> | |
#include <string> | |
#include <iostream> | |
#include <stdio.h> |
This file contains 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] | |
name = "leaf-examples" | |
description = "Examples for the Machine Learning Framework 'Leaf'" | |
version = "0.1.0" | |
authors = ["Michael Hirn <[email protected]>", | |
"Maximilian Goisser <[email protected]>"] | |
[dependencies] | |
csv = "0.14" | |
# cuticula = "0.1.4" |