CodeRunner is a nifty little app for OSX that allows you to play around with test code with minimal fuss. Here are some instructions for setting it up to build Rust code.
- Go to CodeRunner > Preferences...
- Select the Languages tab
- Down the bottom of the list view, click the plus sign to add a new language called
Rust
- Enable the Language uses compilation script checkbox, and click Edit script
- Copy the following code into
compile.sh
:
#!/bin/bash
compname=`echo "$1" | sed 's/\(.*\)\..*/\1/'`
rustc $3 "$1" -o "$compname"
status=$?
if [ $status -eq 0 ]; then
echo $compname
exit 0
elif [ $status -eq 127 ]; then
echo -e "\nTo run code in this language, you need to install the Rust compiler from https://github.com/mozilla/rust/."
fi
exit $status
- In the Run Command textbox, enter
./$compiler
. - Add the following text to the Code Template:
fn main() {
%@
}
- Set the Syntax Mode to None
- Enter
rs
for the File Extension
Broken for me until I did "] then" -> "]; then".