When I tried to do something with "Strings" in C programming language, either it won't give the desired result or I end up in 'Segmentation fault'. Lot of books in C show "Strings" manipulating with pointers. I like C in the sense that we can access the characters with the memory where they sit. But when I compile the full program, it compiles without any error , but finally when I run it , normally I endup in "Segmentation fault".
So thought of learning some string manipulation/Methods in Rust Programming language.
https://doc.rust-lang.org/std/string/struct.String.html#method.from
Wednesday, July 4, 2018
Friday, May 25, 2018
Rust-lang learning continuation...
I tried to start again to read on the Rust-Lang tutorials . I thought , i can start with web development in Rust. Usually I directly jump to advanced side of a language and stop it in a few days :-). Most of the languages I tried that way are ok to start, But Rust is a little more difficult .
For Rust , directly jumping to web development is really tough without understanding the basics. But I am not going to change that method.( really its like ,going back and forth )
Rocket is similar to Flask or Django .. but Rust syntax is killing me.. I can't blame Rust, as it is trying implement safe code. Rust compiler is so rude, seems like it won't allow me to compile a single program :-)
Todays learning:
&'static str
"This basically reads as "a reference to a string slice with the lifetime of static", which means that the string has a lifetime of the global scope"
& is familar symbol for programmers, it is used to reference a variable. Generally to get the address of variable .
just refreshed here - https://www.cs.fsu.edu/~myers/c++/notes/references.html
But what is ' symbol , this is something new to me. it is the lifetime. other programming languages have the scope of the variable. But those languages compilers are not always smart enough to understand the scope of the variables or in other words Rust-lang push to define the life time of the variables for each functions. ( From this, I hope compiler can do the garbage collection by itself)
read more: https://www.quora.com/What-is-the-meaning-of-in-Rust
For Rust , directly jumping to web development is really tough without understanding the basics. But I am not going to change that method.( really its like ,going back and forth )
Rocket is similar to Flask or Django .. but Rust syntax is killing me.. I can't blame Rust, as it is trying implement safe code. Rust compiler is so rude, seems like it won't allow me to compile a single program :-)
Todays learning:
&'static str
"This basically reads as "a reference to a string slice with the lifetime of static", which means that the string has a lifetime of the global scope"
& is familar symbol for programmers, it is used to reference a variable. Generally to get the address of variable .
just refreshed here - https://www.cs.fsu.edu/~myers/c++/notes/references.html
But what is ' symbol , this is something new to me. it is the lifetime. other programming languages have the scope of the variable. But those languages compilers are not always smart enough to understand the scope of the variables or in other words Rust-lang push to define the life time of the variables for each functions. ( From this, I hope compiler can do the garbage collection by itself)
read more: https://www.quora.com/What-is-the-meaning-of-in-Rust
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
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