GithubHelp home page GithubHelp logo

rust-snake's Introduction

Preview

โ” About

In this project, I aimed to test WebAssembly's usability in web applications. I have been dithering around the concept of WASM for a while. In the past, I was never fully able to understand the concept because I was still nascent to the rust scene. However, now that I've becoming somewhat proficient in Rust, I decided to see if I could integrate the web technology to a modern framework/library such as React. It was also a good opportunity to learn a 2D renderer, hence why I also included PixiJS into the scope.

๐Ÿ’ญ Thoughts

I learned a lot from this project; mainly about serializing rust structures into javascript values, interfacing with rust classes through javascript, and a plethora more that does not relate to the scope. I got most of my information in this reference documentation.

Unfortunately, on the fifth day of working on it, I encountered a road block that proved to be arduous to resolve. It seems like the struct that I was memoizing in the app through useRef is not persisting when called through a callback. That means that moving the snake through the Rust struct, as far as I know, is impossible. I have tried to search for resources online regarding integrating WASM to react but didn't find anything that could help with my problem.

I'm confident I could work around this issue by scrapping the React implementation and using a bare compiler, but that would no longer aligned with the aim of the project. Hence, I decided that I won't see this project to completion.

The issue I encountered leads me to believe that, as of right now, the technology is not yet viable or stable enough to be used on web frameworks without extensive tinkering. WASM strikes me as a utility that allows developers to outsource expensive functions from a more performant runtime. It's not something that could serve as a full backend for render sequences, like how I was trying to make it out to be--though that does seem to be a future implementation of it. From what I've searched, it's not really faster than javascript on common tasks, which greatly reduces its viability for the current industry. It's good by itself. You can probably write high performant front-end applications with Rust WASM if you want. I think the real problem comes when comingling it with javascript and trying to make the two languages work together.

โœจ Conclusion

WASM is awesome. I had a blast learning how it and its rust packages work. But it doesn't seem to be an all around tool that will make my web apps run faster. From now on, I'll be experimenting on it more with more utilitarian packages. I think that's where it really shines.

rust-snake's People

Contributors

coreapostrophe avatar

Watchers

 avatar

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.