
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/">
    <channel>
        <title><![CDATA[ The Cloudflare Blog ]]></title>
        <description><![CDATA[ Get the latest news on how products at Cloudflare are built, technologies used, and join the teams helping to build a better Internet. ]]></description>
        <link>https://blog.cloudflare.com</link>
        <atom:link href="https://blog.cloudflare.com/" rel="self" type="application/rss+xml"/>
        <language>en-us</language>
        <image>
            <url>https://blog.cloudflare.com/favicon.png</url>
            <title>The Cloudflare Blog</title>
            <link>https://blog.cloudflare.com</link>
        </image>
        <lastBuildDate>Mon, 13 Apr 2026 18:06:29 GMT</lastBuildDate>
        <item>
            <title><![CDATA[Native Rust support on Cloudflare Workers]]></title>
            <link>https://blog.cloudflare.com/workers-rust-sdk/</link>
            <pubDate>Thu, 09 Sep 2021 13:00:02 GMT</pubDate>
            <description><![CDATA[ Introducing the Cloudflare Workers Rust SDK: write your entire Worker in Rust, no JavaScript required.
 ]]></description>
            <content:encoded><![CDATA[ <p></p><p>You can now write Cloudflare Workers in 100% Rust, no JavaScript required. Try it out: <a href="https://github.com/cloudflare/workers-rs">https://github.com/cloudflare/workers-rs</a></p><p>Cloudflare Workers has long supported the building blocks to run many languages using  WebAssembly. However, there has always been a challenging “trampoline” step required to allow languages like Rust to talk to JavaScript APIs such as <code><i>fetch()</i></code>.</p><p>In addition to the sizable amount of boilerplate needed, lots of “off the shelf” bindings between languages don’t include support for Cloudflare APIs such as KV and Durable Objects. What we wanted was a way to write a Worker in idiomatic Rust, quickly, and without needing knowledge of the host JavaScript environment. While we had a nice “starter” template that made it easy enough to pull in some Rust libraries and use them from JavaScript, the barrier was still too high if your goal was to write a full program in Rust and ship it to our edge.</p><p>Not anymore!</p><p>Introducing the <code>**worker**</code> crate, available on <a href="https://github.com/cloudflare/workers-rs">GitHub</a> and <a href="https://crates.io/crates/worker">crates.io</a>, which makes Rust developers feel right at home on the Workers platform by running code inside the V8 WebAssembly engine. In the snippet below, you can see how the worker crate does all the heavy lifting by providing Rustacean-friendly Workers APIs.</p>
            <pre><code>use worker::*;

#[event(fetch)]
pub async fn main(req: Request, env: Env) -&gt; Result&lt;Response&gt; {
    console_log!(
        "{} {}, located at: {:?}, within: {}",
        req.method().to_string(),
        req.path(),
        req.cf().coordinates().unwrap_or_default(),
        req.cf().region().unwrap_or("unknown region".into())
    );

    if !matches!(req.method(), Method::Post) {
        return Response::error("Method Not Allowed", 405);
    }

    if let Some(file) = req.form_data().await?.get("file") {
        return match file {
            FormEntry::File(buf) =&gt; {
                Response::ok(&amp;format!("size = {}", buf.bytes().await?.len()))
            }
            _ =&gt; Response::error("`file` part of POST form must be a file", 400),
        };
    }

    Response::error("Bad Request", 400)
}</code></pre>
            <p>Get your own Worker in Rust started with a single command:</p>
            <pre><code># see installation instructions for our `wrangler` CLI at https://github.com/cloudflare/wrangler
# (requires v1.19.2 or higher)
$ wrangler generate --type=rust my-project</code></pre>
            <p>We’ve  stripped away all the glue code, provided an ergonomic HTTP framework, and baked in what you need to build small scripts or full-fledged Workers apps in Rust. You’ll find <i>fetch</i>, a router, easy-to-use HTTP functionality, Workers <a href="https://developers.cloudflare.com/workers/runtime-apis/kv">KV stores</a> and <a href="https://developers.cloudflare.com/workers/learning/using-durable-objects">Durable Objects</a>, secrets, and environment variables too. It’s all <a href="https://github.com/cloudflare/workers-rs">open source</a>, and we’d love <a href="https://github.com/cloudflare/workers-rs/issues">your feedback</a>!</p>
    <div>
      <h3>Why are we doing this?</h3>
      <a href="#why-are-we-doing-this">
        
      </a>
    </div>
    <p>Cloudflare Workers is on a mission to simplify the developer experience. When we took a hard look at the previous experience writing non-JavaScript Workers, we knew we could do better. Rust happens to be a great language for us to kick-start our mission: it has first-class support for WebAssembly, and a wonderful, growing ecosystem. Tools like <a href="https://github.com/rustwasm/wasm-bindgen"><code><i>wasm-bindgen</i></code></a>, libraries like <a href="https://crates.io/crates/web-sys"><code><i>web-sys</i></code></a>, and Rust’s powerful macro system gave us a significant starting-off point. Plus, Rust’s popularity is growing rapidly, and if our own <a href="https://github.com/orgs/cloudflare/repositories?q=&amp;type=source&amp;language=rust&amp;sort=">use of Rust at Cloudflare</a> is any indication, there is no question that Rust is staking its claim as a must-have in the developer toolbox.</p><p>So give it a try, leave some feedback, even <a href="https://github.com/cloudflare/workers-rs">open a PR</a>! By the way, we’re always on the lookout for great people to join us, and we are hiring for many open roles (including Rust engineers!) — <a href="https://www.cloudflare.com/careers/">take a look</a>.</p> ]]></content:encoded>
            <category><![CDATA[Cloudflare Workers]]></category>
            <category><![CDATA[Serverless]]></category>
            <category><![CDATA[WebAssembly]]></category>
            <category><![CDATA[Rust]]></category>
            <category><![CDATA[WASM]]></category>
            <category><![CDATA[Developers]]></category>
            <category><![CDATA[Developer Platform]]></category>
            <guid isPermaLink="false">6OsZbm2qTDYQut1ezEzb8p</guid>
            <dc:creator>Steve Manuel</dc:creator>
        </item>
    </channel>
</rss>