Sunday, January 21, 2018

Crates and Modules in Rust Language

I was trying to jump into Rust programming language through Rocket web framework. I know it might be a tough attend to directly start with Rocket without much understanding on the Rust syntax.

I believe I have a minimum understanding on Rust syntax and I thought let learn it reverse way , whenever something comes strange or unknown ,let go reverse and goto the basics.

 So, with that strategy when I jump to Rocket , I came across lot of new things.. Ofcourse Rust has lot of new syntax , terminologies. But since I had some prior knowledge on Flask,Django web frameworks, I did not stunt by the folder structures and initial quick start steps.

but it is really fun learning it in reverse way, lot of new things to understand.

One thing was Crates and Modules. It not a new idea, but it a new term and building it in Rust is quite easy.

We have a good documentation from these from Rust developers.

As per my understanding,

If you know python, we will be using packages there. Similar way we can use Crates to build modules and import them into our program.

I hope below documentation will be enough to read through it and try it.

https://doc.rust-lang.org/book/first-edition/crates-and-modules.html

https://rustbyexample.com/attribute/crate.html

No comments: