caiiiycuk / rust-memfs

wasm32-unknown-unknown with memory file system

Home Page:https://www.rust-lang.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Rust memfs

This branch adds in memory file system for unknown target. This is needed mostly for WebAssembly to populate file system in runtime, like this:

    File::create(file).expect(&format!("Unable to create {}", file))
        .write(include_bytes!("../file"))
        .expect(&format!("Unable to write in {}", file));

Pre-built binaries

Building can take long time, but if your host x86_64-unknown-linux-gnu then you can download pre-built binaries in Releases section.

Building

You need to build rustc compiler it self, basically it can be done with this command:

./x.py build -i --keep-stage 0 library/std --target wasm32-unknown-unknown --target x86_64-unknown-linux-gnu

It's important to pass two targets wasm32-unknown-unknown and your host target, because wasm32 can't be built without host tools.

If you have any problem, please consult with rustc dev documentation

Setup

When rustc is compiled you should add it as toolchain with rustup:

rustup toolchain link memfs build/<host-triple>/stage1

Next you should override toolchain for project where you want to use memfs:

cd <project>
rustup override set memfs

After that you can build your porject for wasm32-unknown-unknown and create/write/read files.

Discalimer

The implemenation if memory FS is not complete I created it only for vange-rs project.

About

wasm32-unknown-unknown with memory file system

https://www.rust-lang.org

License:Other


Languages

Language:Rust 97.7%Language:Python 0.5%Language:JavaScript 0.4%Language:Makefile 0.3%Language:C++ 0.3%Language:Shell 0.3%Language:CSS 0.2%Language:Dockerfile 0.2%Language:HTML 0.1%Language:C 0.1%Language:Roff 0.0%Language:Assembly 0.0%Language:Pascal 0.0%Language:XSLT 0.0%Language:RPC 0.0%Language:CMake 0.0%Language:Puppet 0.0%Language:Batchfile 0.0%Language:RenderScript 0.0%