Giter VIP home page Giter VIP logo

Comments (8)

sunfishcode avatar sunfishcode commented on August 17, 2024 6

WASI doesn't currently have general networking support. We're aware this is an important feature and are working on it.

from wasi.

AchalaSB avatar AchalaSB commented on August 17, 2024 1

@leonwanghui yes in that case try with wasi.
But right now crates like reqwest, hyper, web3, rpc are not webassembly compatible. You may end up with some socket error etc.

from wasi.

devsnek avatar devsnek commented on August 17, 2024

not all rust crates, but probably most rust crates. it's more of a question of what rust's stdlib supports (with the exception of stuff like random).

from wasi.

vitiral avatar vitiral commented on August 17, 2024

It is important to note that WASI is not yet standardized, so any final answer to this question is impossible until it is.

It is also important to note that certain crates are built specifically for certain platforms, i.e. posix or windows. While wasi aims to create a "conceptual operating system" that attempts to be able to emulate most operating systems, it will certainly not support every possible syscall.

So to (maybe) answer your question: most rust crates that are pure logic should work -- which is probably most rust crates.

from wasi.

leonwanghui avatar leonwanghui commented on August 17, 2024

Quite interesting topic. I am learning rust and wasm these days, and here are some conclusions from my side:

  • Not support all crates. When I tried to compile some crates like reqwest, some errors occurred with bad network layer support.
  • Currently for latest Rust (v1.37), there should be three targets supporting wasm which are wasm32-unknown-unknown, wasm32-unknown-emscripten and wasm32-wasi. So I think this could make users confused when choosing target to build the code.
  • I found there are also many wasm compilers, so it's also confusing which one is better.

from wasi.

AchalaSB avatar AchalaSB commented on August 17, 2024

Agree. All rust crates not supported. But most of crates having webassembly support i.e wasm32-unknown-unknown will support (have tested with 5-10 crates).
wasm32-unknown-unknown and wasm32-wasi is almost similar. It is light-weight. wasi is having additional functionality as it is POSIX compliant.
But another target with emscripten, it contains a JS glue code. if you wan't to use syscalls/Filesystems you may use that. And again the code is not optimized you may require external tools to optimize it like wasm-gc

from wasi.

leonwanghui avatar leonwanghui commented on August 17, 2024

@AchalaSB If I get it right, if I want to try some system programming with wasi, the best option is wasm32-wasi target.

from wasi.

leonwanghui avatar leonwanghui commented on August 17, 2024

Found some issues on hyper and reqwest about wasm support: hyperium/hyper#1245 seanmonstar/reqwest#288

from wasi.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.