Posts tagged with :rustlang:
rust
! To be as fast, robust and extremely easy to use as possible.
So far a lot of networking related things are done, as well as databases, and also an entire ECS (Entity Component System)! I was missing a NBT parser, so I decided to embark on the journey to make it myself, and oh boy I did. It's so fast and easy to use.
With the addition of the NBT library, I can work on chunks, and a lot minecraft related features. I hope this server progresses a lot now! The ecs, database and a lot of really core features are done. Oh and also global state! The code is really to my likings, it's pretty clean and robust. I can easily add more features, systems etc.
I've attached some image that showcases the simple use of the library. Since it's rust, I've used the derive macros feature to auto generate deserialize/serialize implementations!
The first image showcases how we can create struct and add derive macros on it. The Serialize macro auto-generates the serialize method. Same with Deserialize.
In the second image we instantiate a Sample
object.
The third image shows how easy it is to just serialize the Sample
object we created into a buffer! You can simply do sample.serialize(&mut bytes)
and the bytes would have the serialized data.
Finally, the last image shows how easy it is to read plain bytes back into the datatype (Sample
) we want. Because its possible it's not a correct type, it returns a result, which in this example we use unwrap
to tell the program that trust me, it's the correct type!
And if we check the result of the deserialize with the initial struct we instantiated, they both are indeed the same!
You can find the github repository here: github.com/Sweattypalms/ferrumc
Would appreciate a star! Thanks! ❤️