Skip to content

Instantly share code, notes, and snippets.

//! HTTP status codes.
use std::fmt;
use std::mem::transmute;
use std::num::{FromPrimitive, ToPrimitive};
use std::cmp::Ordering;
pub use self::StatusCode::*;
pub use self::StatusClass::*;
@pyfisch
pyfisch / gist:4c10dd5ab79a6e715af2
Created January 25, 2015 16:07
What does this error message mean?
Compiling language-tags v0.0.1 (file:///home/michael/Dokumente/git/rust-language-tags)
src/language.rs:26:5: 26:17 error: expected a literal
src/language.rs:26 Language::Ar => "ar",
^~~~~~~~~~~~
src/lib.rs:1:1: 462:1 note: in expansion of phf_map!
src/language.rs:25:62: 31:3 note: expansion site
src/language.rs:27:5: 27:17 error: expected a literal
src/language.rs:27 Language::De => "de",
^~~~~~~~~~~~
src/lib.rs:1:1: 462:1 note: in expansion of phf_map!
@pyfisch
pyfisch / gist:91196db6df376c9638a7
Last active August 29, 2015 14:14
language.rs
#[plugin] #[no_link]
extern crate phf_macros;
extern crate phf;
use std::fmt;
use std::str::FromStr;
use std::ascii::AsciiExt;
#[derive(Clone, Debug, PartialOrd, PartialEq)]
pub enum Language {
fn main() {
let testvector = vec![1, 2, 3];
let a: int = testvector[-1];
println!("{}", a);
}
/* The output:
task '<main>' panicked at 'index out of bounds: the len is 3 but the index is 18446744073709551615', /xxxx/src/main.rs:1
*/
@pyfisch
pyfisch / e1.geojson
Created October 7, 2014 18:49
European long-distance path E1
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
***@***-***:~/src/github.com/syncthing/syncthing$ go run build.go
go get -v code.google.com/p/go.tools/cmd/cover
code.google.com/p/go.tools (download)
code.google.com/p/go.tools/cover
code.google.com/p/go.tools/cmd/cover
go install code.google.com/p/go.tools/cmd/cover: open /usr/local/go/pkg/tool/linux_amd64/cover: permission denied
exit status 1
exit status 1