{"id":13503161,"url":"https://github.com/murarth/rusti","last_synced_at":"2025-03-29T13:30:54.389Z","repository":{"id":24686528,"uuid":"28097592","full_name":"murarth/rusti","owner":"murarth","description":"REPL for the Rust programming language","archived":true,"fork":false,"pushed_at":"2019-07-12T17:55:59.000Z","size":383,"stargazers_count":1322,"open_issues_count":11,"forks_count":58,"subscribers_count":37,"default_branch":"master","last_synced_at":"2024-10-31T22:34:27.801Z","etag":null,"topics":["repl","rust"],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/murarth.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-12-16T17:15:28.000Z","updated_at":"2024-09-22T20:52:10.000Z","dependencies_parsed_at":"2022-08-02T21:00:34.539Z","dependency_job_id":null,"html_url":"https://github.com/murarth/rusti","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/murarth%2Frusti","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/murarth%2Frusti/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/murarth%2Frusti/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/murarth%2Frusti/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/murarth","download_url":"https://codeload.github.com/murarth/rusti/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246190252,"owners_count":20738000,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["repl","rust"],"created_at":"2024-07-31T22:02:39.561Z","updated_at":"2025-03-29T13:30:54.078Z","avatar_url":"https://github.com/murarth.png","language":"Rust","readme":"# Rusti\n\nA REPL for the Rust programming language.\n\n**The rusti project is deprecated. It is not recommended for regular use.**\n\n## Dependencies\n\nOn Unix systems, Rusti requires `libncursesw` (`libncurses` on Mac OS).\n\n## Building\n\nRusti builds with Rust nightly, using the Cargo build system.  \nCurrently, it **must** be built using a nightly release of the Rust compiler\nreleased **no later than 2016-08-01**.\n\nThe recommended method of installation is to use the following command to\n[rustup](https://github.com/rust-lang-nursery/rustup.rs):\n\n    rustup install nightly-2016-08-01\n\n### Installation using Cargo\n\nRusti can be installed directly using Cargo. The following command will\ndownload, compile, and install Rusti, placing it in `~/.cargo/bin/` or your\noperating system equivalent, assuming you haved installed `nightly-2016-08-01`\nusing `rustup`:\n\n    rustup run nightly-2016-08-01 cargo install --git https://github.com/murarth/rusti\n\nThen you can run it like this:\n\n    rustup run nightly-2016-08-01 ~/.cargo/bin/rusti\n\n### Building from a Git clone\n\nIf using [rustup](https://github.com/rust-lang-nursery/rustup.rs),\nthe following command will create an override to use the correct nightly build\nwithin the `rusti` source tree:\n\n    rustup override add nightly-2016-08-01\n\nBuild with Cargo:\n\n    cargo build\n\nRun tests:\n\n    cargo test\n\nRun `rusti`:\n\n    cargo run\n\nInstall:\n\n    cargo install\n\n## Usage\n\nRunning `rusti` gives a prompt that accepts (most) any valid Rust code.\nIf the final statement is an expression, the result will be displayed using the\n`std::fmt::Debug` trait. This is equivalent to `println!(\"{:?}\", expr);`.\n\n```rust\nrusti=\u003e println!(\"Hello, world!\");\nHello, world!\nrusti=\u003e 2 + 2\n4\nrusti=\u003e (0..5).collect::\u003cVec\u003c_\u003e\u003e()\n[0, 1, 2, 3, 4]\n```\n\nIf any delimiters are left open, `rusti` will continue reading input until they are closed.\nOnly then will the code be executed.\n\n```rust\nrusti=\u003e fn factorial(n: u32) -\u003e u32 {\nrusti.\u003e     match n {\nrusti.\u003e         0 =\u003e 0,\nrusti.\u003e         1 =\u003e 1,\nrusti.\u003e         n =\u003e n * factorial(n - 1),\nrusti.\u003e     }\nrusti.\u003e }\nrusti=\u003e factorial(3)\n6\nrusti=\u003e factorial(4)\n24\nrusti=\u003e factorial(5)\n120\n```\n\n`rusti` can also run a file given on the command line.  \nNote that a `rusti` input file is not quite the same as a typical Rust program.\nA typical Rust program contains a function named `main`. While a `rusti`\nprogram can define functions, no functions will be called automatically.\nInstead, all statements not within a function body will be executed sequentially,\njust like interactive mode.\n\n### Loading Crates\n\nLoading crates which are part of the standard Rust distribution is as easy as\ndeclaring the crate, thusly:\n\n```rust\nextern crate foo;\n```\n\nHowever, loading a crate that you have compiled yourself requires some extra steps:\n\n* First, `rusti` must be able to find the location of compiled crate.  \n  You can add a path to its search list using the command line option `-L path`.  \n  `rusti` accepts any number of `-L` arguments.\n* Secondly, `rusti` requires both an `rlib` and a `dylib` version of the\n  compiled crate. If you're building your crate with Cargo, the following\n  command will build the required files for your project's library:\n\n      cargo rustc --lib -- --crate-type=rlib,dylib\n\n  If you're building with rustc directly, simply add `--crate-type=rlib,dylib`\n  to the build command to produce the required files.\n\n### Code completion\n\n`rusti` provides optional support for code completion using [Racer](https://github.com/phildawes/racer).\n\nTo enable code completion, install Racer as outlined in the [Installation Instructions](https://github.com/phildawes/racer#installation) and place the `racer` executable into your `PATH`.\n\n## Commands\n\nThese are special inputs interpreted by `rusti` that are not directly\nevaluated as Rust code, though they may operate on Rust code.\n\nCommands are invoked by entering a line beginning with `.` or `:`, followed by the\nname of the command and, perhaps, some text used by the command.\n\nCommand names may be arbitrarily abbreviated.  \nFor example, `.type` may be abbreviated as `.typ`, `.ty`, or `.t`.\n\n### `.block`\n\nThe `.block` command will run multiple lines of Rust code as one program.\n\nTo end the command and run all code, input `.` on its own line.\n\n```rust\nrusti=\u003e .block\nrusti+\u003e let a = 1;\nrusti+\u003e let b = a * 2;\nrusti+\u003e let c = b * 3;\nrusti+\u003e c\nrusti+\u003e .\n6\n```\n\nEntering `.q` instead will end the command without running code.\n\n### `.exit`\n\nThe `.exit` command exits the REPL loop.\n\n### `.help`\n\nThe `.help` command shows usage text for any available commands.\n\n### `.load`\n\nThe `.load` command evaluates the contents of a named file.\n\n### `.print`\n\nThe `.print` command will display the value of an expression, using the\n`std::fmt::Display` trait. This is equivalent to `println!(\"{}\", expr);`.\n\n### `.type`\n\nThe `.type` command will display the type of an expression without running it.\n\n```rust\nrusti=\u003e .type 42\n42 = i32\nrusti=\u003e .t 'x'\n'x' = char\nrusti=\u003e .t \"Hello!\"\n\"Hello!\" = \u0026'static str\nrusti=\u003e .t (1i32, 2u32)\n(1i32, 2u32) = (i32, u32)\nrusti=\u003e fn foo() -\u003e i32 { 1 }\nrusti=\u003e .t foo\nfoo = fn() -\u003e i32 {foo}\nrusti=\u003e .t foo()\nfoo() = i32\n```\n\n## Limitations\n\nCurrently, Rusti has the following limitations.\nI hope to fix each of them, but some may prove to be large problems to tackle.\n\n* Functions and types are redefined in each round of input.  \n  This is inefficient.\n* `static` items are also redefined in each round of input.  \n  This means that the address of a `static` item will change in every round\n  of input and that the values of `mut` items or those with interior mutability\n  will be reset to their initial definition on each round of input.  \n  This is bad.\n* Use of `thread_local!` causes a crash.  \n  This is bad.\n* `let` declarations are local to the input in which they are defined.  \n  They cannot be referenced later and are destroyed after that round of input\n  completes its execution.  \n  This is inconvenient.\n* And more!\n\n## License\n\nRusti is distributed under the terms of both the MIT license and the\nApache License (Version 2.0).\n\nSee LICENSE-APACHE and LICENSE-MIT for details.\n","funding_links":[],"categories":["Rust"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmurarth%2Frusti","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmurarth%2Frusti","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmurarth%2Frusti/lists"}