This file contains hidden or 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
| #!/usr/bin/env bash | |
| pid=$(pgrep gammastep) | |
| if [[ $1 = "toggle" ]]; then | |
| if pgrep -x "gammastep" > /dev/null; then | |
| kill -9 $(pgrep -x "gammastep"); | |
| else | |
| gammastep -O ${GAMMASTEP_NIGHT:-3500} & | |
| fi |
There are three main concepts with Rust:
- Ownership (only one variable "owns" the data at one time, and the owner is in charge of deallocating)
- Borrowing (you can borrow a reference to an owned variable)
- Lifetimes (all data keeps track of when it will be destroyed)
These are fairly simple concepts, but they are often counter-intuitive to concepts in other languages, so I wanted to give a shot at