Reminiscing this and that, on the web since 1995

Tagged rust

Web frameworks in Rust

Published tagged , , .

When doing a web application server, one of the first things to decide is which "web application framework" or "request handler library" to use. In Rust, there are more alternatives for that question than in most programming languages, and anyone who has ported some code from tomcat jsp to play framework or from flask to django may dread making the wrong choice. On the other hand, Rust being very strict on static typing makes it very easy to do major refactorings, and I have switched existing projects from iron to nickel to gotham to warp myself without too big problems.

This page collects some of my personal thoughts on each alternative as of September 2020.

Läs och kommentera inlägget Web frameworks in Rust

Julia fractals in Rust wasm

Published tagged , , , , .

I like to write programs to render fractals, and especially Julia set fractals. I also like the Rust programming language. Among other advantages it happens to be great for compiling to wasm, the new format for executing code in a web browser. And I like to code stuff for the webb. So how come I haven't written a wasm Julia renderer in Rust yet?

Well, now I have.

Läs och kommentera inlägget Julia fractals in Rust wasm


Published tagged , , , , , , .

Jag har inte lagt upp någon propagandacykling här på bloggen på ganska länge. Naturligtvis cyklar jag fortfarande till jobbet de flesta av de dagar jag inte jobbar hemifrån, och jag brukar ta en bild och lägga ut på twitter.

Men jag har ett projekt för att organisera mitt bildarkiv på gång också. Det har kommit så långt att det är smidigare att lägga upp mina bilder där än här. Så vill du se mina samlade cykelbilder så finns de där!

Men jag får väl inkludera tre ganska färska bilder här också.


Write a comment

Rust and the web in 2018

Published tagged , , , .

There is A Call for Community Blogposts over at the Rust Programming Language Blog. This is my entry.

I mainly do "server-based" web service development. The server sends html, css, images, and javascript to the browser. The javascript implements progressive enhancement for the content, but the site should be usable and as nice as possible even with javascript disabled. So while I certainly do RESTful json API:s, I also do server-side html templateing, css (and scss) minification, etc. I think Rust has great potential here, partly because of optimization and execution speed, but mainly because the type safety and fearless concurrency make it easy to actually get things right and avoid unpleasant surprises at runtime.

My wish for Rust in 2018 is a nice and convenient web service framework that runs on stable rust and gets maintenance and regular updates for many years to come. My intent for 2018 is to continue to maintain and improve ructe (and rsass), and try to integrate it with the best such framework i can find.

I currently have two web service projects in rust: homesite is a trivial example using iron and rphotos (https://img.krats.se/) is a more ambitious photo gallery / management app using nickel. Unfortunately, both iron and nickel seems more or less abandoned, as both still depend on hyper version 0.10.

Rocket.rs seems awesome, but requires unstable rust, and I would prefer to build my projects with the stable toolchain.

Maybe gotham can be the framework I'm looking for? I think it needs a lot easier request routing and path extraction, but there seems to be work going on to fix that. And maybe that is something I can help create? There are some issues tagged discussion and help wanted which might provide good starting points. And there is the Gotham book to read.

Or maybe either iron or nickel will make a comeback? There are open issues in both about working with hyper version 0.11 (iron#501 and nickel.rs#402), even if they haven't seen much activity recently.

Write a comment

A compiling template system in Rust

Published tagged , , , .

When developing web applications, it is often useful to have a template system. Something that lets you write generic versions of web pages, that the application can fill with the specific content for each page it should show. There exists lots of "languages" to write such templates, such as mustache, jinja2, and play 2 scala templates (twirl).

Most fits very well with a dynamic language, where you can get properties from an object, or even call a method, by its name in a plain string. In a statically compiled language, the actual names of fields and methods are not relevant, and generally not present, after compilation. This makes a "dynamic" template language a hard match for a compiling language such as rust. So why not try to create a better match?

Läs och kommentera inlägget A compiling template system in Rust