Skip to content

Latest commit

 

History

History
 
 

wasm-rust-xor

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
name slug description framework useCase css deployUrl demoUrl relatedTemplates
WASM Rust XOR Exclusive Or Example
edge-wasm-rust-xor
Perform XOR bitwise operations in your API with Rust and WebAssembly using Edge Functions.
None
Edge Function
None
edge-hello-world
edge-wasm-rust-hello-world

WASM Rust XOR Exclusive Or Example

Perform XOR bitwise operations in your API with Rust and WebAssembly using Edge Functions.

This examples takes two 32-bit numbers as inputs (the a and b query parameters) and uses a WASM function written in Rust to exclusive or them.

Demo

https://wasm-rust-xor.vercel.app/api/xor?a=0xac38b505&b=0x83ba94e4

How to Use

You can choose from one of the following two methods to use this repository:

One-Click Deploy

Deploy the example using Vercel:

Deploy with Vercel

Clone and Deploy

Execute create-next-app with npm or Yarn to bootstrap the example:

npx create-next-app --example https://github.com/vercel/examples/tree/main/edge-functions/wasm-rust-xor edge-wasm-rust-xor
# or
yarn create next-app --example https://github.com/vercel/examples/tree/main/edge-functions/wasm-rust-xor edge-wasm-rust-xor

To build and run the example locally, you'll need to install the following prerequisites:

  1. Rust: The API Route for this example is written in Rust and requires the Rust toolchain to build.
  2. wasm-pack: is a helpful utility that builds, optimizes and packages Rust into WebAssembly. This example uses it for the build and optimization step (although it does not use it for packaging).

Then, install the Vercel CLI which you'll use to run the app:

npm i -g vercel

Run the app at the root of the repository:

vercel dev

Deploy it to the cloud with Vercel (Documentation).