papyrus
A rust REPL and script running tool
See the rs docs and the usage guide Look at progress and contribute on github.
Installation
papyrus
depends on proc-macro2
and syn
which contains features that are only available on a nightly compiler. Further to this, the features are underneath a config flag, so compiling requires the RUSTFLAGS
environment variable to include --cfg procmacro2_semver_exempt
.
Switch to a nightly compiler.
Linux, Mac
RUSTFLAGS="--cfg procmacro2_semver_exempt"
Windows
$env:RUSTFLAGS="--cfg procmacro2_semver_exempt"
REPL
papyrus run
will start the repl!
Shell Context Menu
Add right click context menu. (May need admin rights)
Remove right click context menu. (May need admin rights)
Run papyrus from command line.
Implementation Notes
- Right click on a
.rs
or.rscript
file and chooseRun with Papyrus
to compile and run code! - Papyrus will take the contents of the source code and construct a directory to be used with
cargo
. For now the directory is created under a.papyrus
directory in the users home directory. - The compiled binary will be executed with the current directory the one that houses the file. So
env::current_dir()
will return the directory of the.rs
or.rscript
file.
Example - .rs
File hello.rs
.
;
) {
);
}
Use papyrus to execute code.
The src/main.rs
will be populated with the same contents as hello.rs
. A Cargo.toml
file will be created, where some_crate
will be added as a dependency some-crate = "*"
.
Example - .rscript
File hello.rscript
.
;
);
Use papyrus to execute code.
The src/main.rs
will be populated with a main function encapsulating the code, and crate references placed above it. A similar Cargo.toml
will be created as before.