azerupi

u/azerupi


r/rust•

I am in a programming class where our final assignment will be to program a bot to play a certain game. The teachers will provide the "game server" and our bots will have to communicate with the server using sockets. The class is originally using Python, but I was allowed to try it in Rust if I wanted to.

They haven't released the server yet, so I don't know exactly what the communication format will be. But in a couple of assignments they introduced Python sockets and used the pickle module to convert data to binary form.

My question is, is there a way I could make a client in Rust if they send data encoded with pickle? Given that it's a school assignment with a deadline and all, I am

39

r/rust•

I proposed to give a talk about Rust at my university and they are very enthusiastic about it. My audience will consist mostly of engineering students with a specialization in Programming and Software engineering. They should have experience with C / C++ so I would like to talk about the benefits of using Rust and show a couple of examples where Rust would have caught a memory bugs.

The talk should stay approachable for people with no systems programming experience and I would maybe also like to compare Rust with garbage collected languages.

This is the kind of style and content I am going for: Presentation by Alex Crichton

I remember watchi

1937

r/rust•

I would like to work on a Rust wrapper for the OpenFX API. It's the first time I do FFI, I am a little lost but I would like to learn. Is anyone interested to collaborate on this project?

Edit: openfx-sys, repo for the bindings

OpenFX API

The OpenFX API aims to be a standard plug-in API for Image Processing applications. It is used in visual effects applications like Nuke, Natron, Davinci Resolve, ...

The API is made of a couple of C headers that define types and functions the plug-

53

r/rust•

I have switched from css to stylus in mdBook and at compile time I have a build script that calls the stylus executable to generate the css. But I don't want to force users to install stylus on their computer to use mdBook as a crate. The css does not change after uploading to crates.io, therefore there is no need to generate the css at every build (for the user).

How would I go about only executing the build script while developing and publishing the generated css instead of the stylus files when uploading to crates.io?

34

r/rust•

I am trying to improve my documentation by adding examples etc. But the examples generate files and directories in my repository. I could just mark them as ignore to avoid tests being run on the code examples but then I loose one of the advantages of using rustdoc. Another solution would be to have hidden clean-up code, but that is very cumbersome to do for each example.

How is that normally handled?

45

r/rust•

I have been working on my own implementation of Rustbook / Gitbook lately. It's not done yet, but I wanted to present it to the community to get feedback and eventually some help from interested rustaceans ;)

Here is the repo: https://github.com/azerupi/mdBook

mdinger recommended me to show a live book rendered with mdbook. Here it is: http://azerupi.github.io/mdBook/. You can see that it's already "usable" for test projects but it still needs some polishing and development to be even considered in a real project.

Motivation behind the project

I have contributed a little to the Rustbook and I wanted to use i

510

r/rust•

Hi,

I implemented the least square linear regression method. My code works and does what it is supposed. But I always have a feeling like it could be written in a much better way.

So to see how more experienced Rust programmers would write it, how could I improve this code:

fn least_square_slope<T>(points: &Vec<(T,T)>) where T: num::traits::ToPrimitive {

    let (x_mean, y_mean): (f64, f64) = (
        points.iter().fold(0f64, |acc, ref point| {
                acc + point.0.to_f64().unwrap()
            }
        ) / (points.len() as f64),

        points.iter().fold(0f64, |acc, ref point| {
                acc + point.1.to_f64().unwrap(
1831

You've reached the end of this feed.