$ rustc test.rs
test.rs:5:19: 5:24 error: unresolved name `Test1`.
test.rs:5 let x: Test = Test1;
^~~~~
error: aborting due to previous error
$ rustc --version
rustc 0.13.0-nightly (399ff259e 2014-11-20 00:27:07 +0000)
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
Compiling simple-logging v0.0.1 (file:///home/daboross/Projects/Rust/simple-logging) | |
/home/daboross/Projects/Rust/simple-logging/src/loggers.rs:65:21: 65:27 error: the trait `for<r> core::ops::Fn<(&r str,), collections::string::String>` is not implemented for the type `Box<core::ops::Fn<(&str,), collections::string::String>+Send>` | |
/home/daboross/Projects/Rust/simple-logging/src/loggers.rs:65 format: format, | |
^~~~~~ | |
/home/daboross/Projects/Rust/simple-logging/src/loggers.rs:65:21: 65:27 note: the trait `core::ops::Fn` must be implemented for the cast to the object type `core::ops::Fn<(&str,), collections::string::String>+Send` | |
/home/daboross/Projects/Rust/simple-logging/src/loggers.rs:65 format: format, | |
^~~~~~ | |
error: aborting due to previous error | |
Could not compile `simple-logging`. |
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
pub trait Logger { | |
fn log(&self, msg: &str); | |
} | |
pub struct LoggerImpl1; | |
pub struct LoggerImpl2; | |
impl LoggerImpl1 { | |
pub fn new() -> LoggerImpl1 { |
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
impl LoggerOutput { | |
pub fn into_logger(self) -> Box<Logger + 'static> { | |
return box match self { | |
LoggerOutput::File(path) => WriterLogger::with_file(&path).unwrap(), | |
LoggerOutput::Stdout => WriterLogger::with_stdout(), | |
LoggerOutput::Stderr => WriterLogger::with_stderr(), | |
}; | |
} | |
} |
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() { | |
f1(Some(("value 1".to_string(), "value 2".to_string()))) | |
} | |
fn f1(original: Option<(String, String)>) { | |
let shared = original.as_ref().map(|&(ref a, ref b)| (a.as_slice(), b.as_slice())); | |
f2(shared); | |
} |
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
Compiling zaldinar v0.0.1 (file:///home/daboross/Projects/Rust/zaldinar) | |
/home/daboross/Projects/Rust/zaldinar/src/lib.rs:137:56: 137:61 error: borrowed value does not live long enough | |
/home/daboross/Projects/Rust/zaldinar/src/lib.rs:137 let shared_ctcp = message.ctcp.as_ref().map(|&(ref a, ref b)| (a.as_slice(), b.as_slice())); | |
^~~~~ | |
/home/daboross/Projects/Rust/zaldinar/src/lib.rs:133:60: 189:6 note: reference must be valid for the block at 133:59... | |
/home/daboross/Projects/Rust/zaldinar/src/lib.rs:133 fn process_message<'a>(&self, message: &'a IrcMessage) { | |
/home/daboross/Projects/Rust/zaldinar/src/lib.rs:134 let shared_mask: Option<&str> = message.mask.as_ref().map(|s| &**s); | |
/home/daboross/Projects/Rust/zaldinar/src/lib.rs:135 let shared_args = message.args.iter().map(|s| &**s).collect::<Vec<&'a str>>(); | |
/home/daboross/Projects/Rust/zaldinar/src/lib.rs:136 // |
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
Compiling zaldinar v0.0.1 (file:///home/daboross/Projects/Rust/zaldinar) | |
/home/daboross/Projects/Rust/zaldinar/src/lib.rs:136:27: 136:34 error: cannot move out of dereference of `&`-pointer | |
/home/daboross/Projects/Rust/zaldinar/src/lib.rs:136 let shared_ctcp = message.ctcp.map(|(ref a,ref b)| (&**a, &**b)); | |
^~~~~~~ | |
/home/daboross/Projects/Rust/zaldinar/src/lib.rs:136:46: 136:51 error: borrowed value does not live long enough | |
/home/daboross/Projects/Rust/zaldinar/src/lib.rs:136 let shared_ctcp = message.ctcp.map(|(ref a,ref b)| (&**a, &**b)); | |
^~~~~ | |
/home/daboross/Projects/Rust/zaldinar/src/lib.rs:133:60: 188:6 note: reference must be valid for the block at 133:59... | |
/home/daboross/Projects/Rust/zaldinar/src/lib.rs:133 fn process_message<'a>(&self, message: &'a IrcMessage) { | |
/home/daboross/Projects/Rust/zaldinar/sr |
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
Compiling irc v0.0.1 (file:///home/daboross/Projects/Rust/Learn/basic-irc) | |
/home/daboross/Projects/Rust/Learn/basic-irc/src/lib.rs:193:64: 193:65 error: `s` does not live long enough | |
/home/daboross/Projects/Rust/Learn/basic-irc/src/lib.rs:193 let shared_mask = message.mask.map(|s: String| s.as_slice()); | |
^ | |
/home/daboross/Projects/Rust/Learn/basic-irc/src/lib.rs:191:18: 212:14 note: reference must be valid for the block at 191:17... | |
/home/daboross/Projects/Rust/Learn/basic-irc/src/lib.rs:191 loop { | |
/home/daboross/Projects/Rust/Learn/basic-irc/src/lib.rs:192 let message: IrcMessage = self.data_in.recv(); | |
/home/daboross/Projects/Rust/Learn/basic-irc/src/lib.rs:193 let shared_mask = message.mask.map(|s: String| s.as_slice()); | |
/home/daboross/Projects/Rust/Learn/basic-irc/src/lib.rs:194 let args_shared = &[];//message |
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
#![feature(globs)] | |
extern crate serialize; | |
use std::io::*; | |
use std::sync::{Arc, RWLock}; | |
use std::ascii::AsciiExt; | |
use std::collections::HashMap; | |
use serialize::json; |
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
struct Client { | |
option: Option<String>, | |
} | |
fn main() { | |
let mut client = Client { | |
option: Some("address".into_string()) | |
}; | |
let address = match client.option { | |
Some(v) => { |