fazer relógio – recompilar

Recompilar automaticamente quando um arquivo muda é a próxima melhor coisa se uma repl não for possível. Felizmente, é extremamente fácil de fazer no Linux com ferramentas inotify.

Obtenha ferramentas inotify

sudo apt-get install inotify-tools

Adicione relógio ao seu makefile. Aqui está um exemplo extremamente básico,

CC=rustc
OUT
=out
SRC
=main.rs
CFLAGS
=

all
:
$
(CC) $(CFLAGS) $(SRC) -o $(OUT)

clean
:
rm
-f $(OUT)

watch
:
while true; do inotifywait $(SRC) && clear && make; done

Depois é só usá-lo e o make será chamado toda vez que um arquivo for modificado.

make watch