idata
At the moment this lib
is for my personal use. Therefore, I will be
adding new features, as soon as I need them.
Small tools to work with rust reducing mutability and programming more functional way.
- Mutability and sharing is bad.
- Viric mutability is bad.
- Mutability on large pieces of code is bad.
In Rust, we can have no viric, not shared mutability. Lets use this feature.
This small tools aims to help with this points
Usage
Add to cargo.toml
[]
= "0.1.0"
Modifications
0.1.0 First version
TODO
At the moment this lib
is for my personal use. Therefore, I will be
adding new features, as soon as I need them.
Some examples
A very basic example...
extern crate idata;
use IVec;
Push an element to a vector, and return the same vector
extern crate idata;
use IVec;
Append a vector to another
extern crate idata;
use IVec;
Remove an element from back of a vector
extern crate idata;
use IVec;
Try getting a char from top of a Chars returning the (char, remaining_chars) if possible
extern crate idata;
Adding char to an string
extern crate idata;
use IString;
Adding string to an string
extern crate idata;
use IString;
Removing last char to a String
extern crate idata;
use IString;
Recursive simulation with TCO
We cannot use SSA
in rust
combined with a for loop
It fits fine with recursion, but...alloc
Rust doesn't have TCO
(tail call optimization) in recursion.
In some cases it could be expensive and even dangerous
One option, could be to use next "trampolin"
extern crate idata;
use *;