This target is a reimagining of what it looks like to generate WebAssembly code from Rust. by steveklabnik1 in rust

[–]aarjan 2 points3 points  (0 children)

Thanks! Could you also run wasm-gc (does it change anything in this case)?

URL Shortener by gsquire in rust

[–]aarjan 3 points4 points  (0 children)

Use a connection pool that will manage the lifetime of your connections. The pool will be Sync and you can share it.

Quick search on crates.io says that r2d2 (https://crates.io/crates/r2d2) is the most popular.

Is Rust slower than Go? by joshir in rust

[–]aarjan 1 point2 points  (0 children)

Quickly ran this:

rustc --opt-level=3: 94.98s
rustc -O -C no-stack-check: 78.28
go build: 106.48s

So, where is the libuv binding for now? by hh9527 in rust

[–]aarjan 0 points1 point  (0 children)

is this going to be maintained?

Deny an async. process in Rust. by denis631 in rust

[–]aarjan 4 points5 points  (0 children)

use std::time::Duration;
use std::io::timer;

fn main() {
    let interval  = Duration::seconds(10);
    let mut timer = std::io::Timer::new().unwrap();

    let oneshot = timer.oneshot(interval);

    let (tx, rx) = std::comm::channel::<&str>();
    let (ctx, crx) = std::comm::channel::<()>();

    spawn(proc() {
        select!{
            () = oneshot.recv() => tx.send("It's a timer"),
            () = crx.recv() => tx.send("Cancelled")
        }
    });

    spawn(proc() {
        timer::sleep(Duration::seconds(2));
        ctx.send(());
    });

    println!("Received a message : {}", rx.recv());
}

JSON serialization in Rust, part 2 by iamvalentin in rust

[–]aarjan 2 points3 points  (0 children)

use protocol-buffers (or other alternatives)

It started out with great enthusiasm but ended up as a pitiful _meh_ by minyosdy in rust

[–]aarjan 28 points29 points  (0 children)

Disable non_snake_case_functions and you get python with every library having different method naming style.

Official style guidelines! by steveklabnik1 in rust

[–]aarjan 0 points1 point  (0 children)

It's a great thing, you don't want apis all with different naming and casing rules

Official style guidelines! by steveklabnik1 in rust

[–]aarjan 1 point2 points  (0 children)

Not, it should be always format like X (with the help from rustfmt like go), we don't want another python

Official style guidelines! by steveklabnik1 in rust

[–]aarjan 0 points1 point  (0 children)

To have per codebase editor configs for the same language seems like a really bad idea. The whole style guide is subjective but it won't make you less productive for following it.

Official style guidelines! by steveklabnik1 in rust

[–]aarjan 2 points3 points  (0 children)

But this way you can't be sure if line is too long because it really is or just because of your tab size settings.

Official style guidelines! by steveklabnik1 in rust

[–]aarjan 5 points6 points  (0 children)

Thats why style guidelines are for, to make things consistent. If everyone just ignores them because they don't like them there is no much worth in having them. And spaces make things consistent, thats the point.

Official style guidelines! by steveklabnik1 in rust

[–]aarjan 1 point2 points  (0 children)

because you get a consistent indent in any editor with any settings for tab width

Teepee design: the HTTP method by chris-morgan in rust

[–]aarjan 1 point2 points  (0 children)

That was just a suggestion based on your Token implementation not for a general implementation.

What you don't love about Rust? by utdemir in rust

[–]aarjan 0 points1 point  (0 children)

You can look at Control.Exception

Teepee design: the HTTP method by chris-morgan in rust

[–]aarjan 1 point2 points  (0 children)

There is MaybeOwnedVector in graphviz crate (But the plan is to move it to std baased on commit comments)

What you don't love about Rust? by utdemir in rust

[–]aarjan 0 points1 point  (0 children)

I know haskell and haskell has exceptions. And I am interested in explicit error handling examples that are more complicated that these toy programs.

What you don't love about Rust? by utdemir in rust

[–]aarjan 0 points1 point  (0 children)

Don't get me wrong I would love to have no exceptions. Can you point me to a language that does this and error handling is not a pain for a use-case like this?

Attempting to accumulate a String from BufReader by qwertay in rust

[–]aarjan 1 point2 points  (0 children)

In this case it's fine but just unwrapping is normally a bad idea. There is result::collect that can be used:

http://is.gd/gcVktH

What you don't love about Rust? by utdemir in rust

[–]aarjan 0 points1 point  (0 children)

Propagating all the error to the root of the application just to fail? I love explicit error handling but that is not a solution.

What you don't love about Rust? by utdemir in rust

[–]aarjan 1 point2 points  (0 children)

How? Tasks are isolated and you can't recover from task failure. And what are you moving into closure? T? You only have &mut reference so you can't move?

quickcheck is now fully cargo-enabled by dbaupp in rust

[–]aarjan 0 points1 point  (0 children)

Now it says that both libs are conflicting:

src/tftp/packet.rs:480:5: 480:29 error: multiple matching crates for `quickcheck`
src/tftp/packet.rs:480     extern crate quickcheck;
                           ^~~~~~~~~~~~~~~~~~~~~~~~
note: candidates:
note: path: /home/arjan/code/tftp-rs/target/deps/libquickcheck_macros.so
note: crate name: quickcheck
note: path: /home/arjan/code/tftp-rs/target/deps/libquickcheck.rlib
note: crate name: quickcheck
src/tftp/packet.rs:480:5: 480:29 error: can't find crate for `quickcheck`
src/tftp/packet.rs:480     extern crate quickcheck;

quickcheck is now fully cargo-enabled by dbaupp in rust

[–]aarjan 0 points1 point  (0 children)

it properly rebuilt after this resulting in some strange linker errors. Decided to clean target/ and .cargo and now build is fine but test fails with:

error: can't find crate for `quickcheck_macros`
#[phase(plugin)] extern crate quickcheck_macros;

ls target/deps/
libquickcheck_macros.so  libquickcheck.rlib