Skip to main content
Filter by
Sorted by
Tagged with
3 votes
1 answer
1k views

As seen in this repository: https://github.com/ReactiveX/RxRust/blob/master/src/lib.rs#L110 let gen = move |:| { let it = range(0is, 20is); // ~~~ ~~~~ let q = Box::new(...
Zomagk's user avatar
  • 325
3 votes
1 answer
673 views

I'm looking through some old (~2014) Rust code and I'm seeing this code block: fn compile(self, func:&UncompiledFunction<'a>) -> &'a Val { unsafe { use std::raw::Repr; ...
Matt's user avatar
  • 3,567
3 votes
1 answer
635 views

I am trying to run the hyper example listed on the Github readme. extern crate hyper; use std::io::Write; use hyper::Server; use hyper::server::Request; use hyper::server::Response; use hyper::net::...
bipvanwinkle's user avatar
18 votes
2 answers
6k views

With today's Rust nightly the following code doesn't compile anymore: #[derive(Show)] enum S { A, B } fn main() { println!("{}", S::A); } Instead it gives me the following error message: ...
ujh's user avatar
  • 4,083
9 votes
1 answer
707 views

Can somebody help me to rewrite this piece of code with new unboxed closures: struct Builder; pub fn build(rules: |params: &mut Builder|) -> Builder { let mut builder = Builder::new(); ...
Stanislav Panferov's user avatar
6 votes
2 answers
410 views

When I run the following code, I get some output: use std::thread::Thread; static DELAY: i64 = 1000; fn main() { Thread::spawn(move || { println!("some output"); }); std::io::...
tshepang's user avatar
  • 12.5k
2 votes
1 answer
3k views

In 0.13.0-nightly the following code won't compile: fn main() { let a = (10.5f64).sqrt(); } I get the error: error: type `f64` does not implement any method in scope named `sqrt` What am I doing ...
RajV's user avatar
  • 7,292
3 votes
1 answer
615 views

Trying to write something similar to Haskell's HList, with the ability to search by type. With the below code, in play.rust-lang.org version rustc 0.13.0-dev (567b90ff0 2014-12-13 20:02:15 +0000) I ...
Sgeo's user avatar
  • 95
7 votes
3 answers
14k views

I can see I have to import like this: use std::io::IoResult; use std::num::{Int, ToPrimitive}; use std::rand::{OsRng, Rng}; Then make a new instance of OsRng, and try to generate a new u32 int from ...
leshow's user avatar
  • 1,668
1 vote
1 answer
177 views

This compiles: use std::num::pow; pub fn main() { let (tx, rx): (Sender<u64>, Receiver<u64>) = channel(); let square_tx = tx.clone(); let square = proc() { let mut x ...
Jin's user avatar
  • 13.7k
9 votes
1 answer
6k views

I have a newtype wrapper around an array. I assumed that I could use size_of instead of manually passing the size of the array around, but the compiler thinks I'm wrong. use std::mem::{size_of, ...
rraval's user avatar
  • 1,027
2 votes
2 answers
2k views

This question refers to Rust as of October 2014. If you are using Rust 1.0 or above, you best look elsewhere for a solution. I have a long running Rust process that generates log values, which I'm ...
Doug's user avatar
  • 35.7k
2 votes
2 answers
6k views

I want to create a library for rust. This is the Cargo.toml file for my project : [package] name = "binary_tree" version = "0.0.1" authors = ["Guillaume Bersac <[email protected]>"] [lib] ...
Moebius's user avatar
  • 6,668
5 votes
1 answer
746 views

Editor's note: The code in this question predates Rust 1.0. Since then, semantics have changed and some of the assertions made in the question are no longer true. I have the following piece of code: ...
tbicr's user avatar
  • 26.4k
1 vote
2 answers
5k views

Editor's note: The code presented in the question compiles as-is in Rust 1.0. I've tried: trait Inner {} struct Outer<'a> { inner: &'a Inner, } but the compiler complains: ...
fadedbee's user avatar
  • 45.3k

15 30 50 per page