Last active
March 6, 2023 21:20
-
-
Save gwpl/75ed3361f7e1173e0763989ab36df641 to your computer and use it in GitHub Desktop.
Rust session Illustrate Value change in vector
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#If you run in terminal multiplexxer... | |
# (or code editor and terminal to see complile+run output) | |
# like screen or tmux, | |
# you may want in one to have | |
$ $EDITOR l1.rs | |
# and in another: | |
echo l1.rs | entr -cs 'rustc l1.rs && ./l1' | |
# this will automatically, every time you save file: clear terminal, compile and run |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ echo $PS1mini | |
\[\033[01;37m\]$\[\] | |
$ PS1=$PS1mini # let's make prompt minimal to copy and paste | |
$ cat > l1.rs <<ENDL | |
> fn main() { | |
> let mut v = vec![0, 1, 2, 3]; | |
> v[1] = 11; | |
> println!("v={:?}", v); | |
> } | |
> ENDL | |
$ rustc l1.rs && ./l1 | |
v=[0, 11, 2, 3] | |
$ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment