Better Programming

Advice for programmers.

Member-only story

Create a Serverless Rust Function for Fast Experience

4 min readAug 4, 2022

--

Photo by ryan baker on Unsplash

I find serverless amazing: the speed, versatility, and ease of development are incredible. If you read my latest story about deploying your first JS serverless worker, you already know that I am using Cloudflare workers as my canvas to build functions and APIs I want to be accessible through a URL.

Cloudflare workers are run in chrome V8 isolates that find their runtime in Cloudflare’s Global network, meaning that your serverless functions are run securely in a runtime that supports and runs other isolates (here, you find the efficiency of Cloudflare workers).

As you can guess by the title and subtitle, CF workers support Rust natively, thanks to WebAssembly. This technology allows languages like C and Rust to be executed on the browser (remember that workers run on chrome V8 runtime), thus giving the Cloudflare development team an environment to have their workers write with Rust and enjoy the language’s safety and efficiency (both in speed and development effort).

Let’s now take a look at creating our first serverless function with Rust and deploy it just like with JS (I recommend also reading this article to get more familiar with what we are doing if Rust isn’t in your most used languages).

--

--

Tommaso De Ponti
Tommaso De Ponti

Written by Tommaso De Ponti

Building stuff, #Stellar. https://tdep.xycloo.com. Check my personal blog at https://heytdep.github.io for more specific and/or advanced articles.