{"id":20162586,"url":"https://github.com/zdharma-continuum/zinit-annex-rust","last_synced_at":"2025-04-10T00:36:05.153Z","repository":{"id":43733708,"uuid":"423393465","full_name":"zdharma-continuum/zinit-annex-rust","owner":"zdharma-continuum","description":"Unmaintained mirror of zinit-zsh/z-a-rust","archived":false,"fork":false,"pushed_at":"2023-04-16T05:39:31.000Z","size":192,"stargazers_count":6,"open_issues_count":1,"forks_count":4,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-24T02:21:56.712Z","etag":null,"topics":["zinit","zinit-annex","zsh"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zdharma-continuum.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2021-11-01T08:39:44.000Z","updated_at":"2025-01-19T11:28:44.000Z","dependencies_parsed_at":"2024-04-16T14:36:27.086Z","dependency_job_id":"ad9e04a5-b8b5-48ed-b294-6a8a4155b6fb","html_url":"https://github.com/zdharma-continuum/zinit-annex-rust","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/zdharma-continuum%2Fzinit-annex-rust","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zdharma-continuum%2Fzinit-annex-rust/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zdharma-continuum%2Fzinit-annex-rust/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zdharma-continuum%2Fzinit-annex-rust/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zdharma-continuum","download_url":"https://codeload.github.com/zdharma-continuum/zinit-annex-rust/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247749960,"owners_count":20989714,"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":["zinit","zinit-annex","zsh"],"created_at":"2024-11-14T00:25:50.429Z","updated_at":"2025-04-10T00:36:05.130Z","avatar_url":"https://github.com/zdharma-continuum.png","language":"Shell","funding_links":[],"categories":["Plugins"],"sub_categories":["ZSH on Windows"],"readme":"# zinit-annex-rust\u003ca name=\"zinit-annex-rust\"\u003e\u003c/a\u003e\n\nA Zsh-Zinit annex that installs rust and cargo packages locally inside the plugin or snippet directories. The crate can\nthen have a so called *shim* created (name borrowed from `rbenv`) – a script that's located in the standard `$PATH`\nentry \"`$ZPFX/bin`\" of following contents (example):\n\n```zsh\n#!/usr/bin/env zsh\n\nfunction lsd {\n  local bindir=\"/root/.zinit/plugins/zdharma-continuum---null/bin\"\n  local -x PATH=\"/root/.zinit/plugins/zdharma-continuum---null\"/bin:\"$PATH\" # -x means export\n  local -x RUSTUP_HOME=\"/root/.zinit/plugins/zdharma-continuum---null\"/rustup CARGO_HOME=\"/root/.zinit/plugins/zdharma-continuum---null\"\n\n  \"$bindir\"/\"lsd\" \"$@\"\n}\n\nlsd \"$@\"\n```\n\nAs it can be seen shim ultimately provides the binary to the command line.\n\n![example zinit-annex-rust use](https://raw.githubusercontent.com/zdharma-continuum/zinit-annex-rust/master/images/z-a-rust.png)\n\n\u003c!-- mdformat-toc start --slug=github --maxlevel=6 --minlevel=2 --\u003e\n\n- [Installation](#installation)\n- [Usage](#usage)\n  - [Options](#options)\n- [Examples](#examples)\n  - [Install rust, the `lsd` crate, and a `lsd` shim exposing the binary](#install-rust-the-lsd-crate-and-a-lsd-shim-exposing-the-binary)\n  - [Install rust, the `exa` crate, and a `ls` shim exposing the `exa` binary](#install-rust-the-exa-crate-and-a-ls-shim-exposing-the-exa-binary)\n  - [Install rust and then the `exa` and `lsd` crates](#install-rust-and-then-the-exa-and-lsd-crates)\n  - [Installs rust and then the `exa' and `lsd' crates and exposes their binaries by altering $PATH](#installs-rust-and-then-the-exa-and-lsd-crates-and-exposes-their-binaries-by-altering-path)\n  - [Installs rust and then the `exa` crate and creates its shim with standard error redirected to /dev/null](#installs-rust-and-then-the-exa-crate-and-creates-its-shim-with-standard-error-redirected-to-devnull)\n  - [Install Rust and make it available globally in the system](#install-rust-and-make-it-available-globally-in-the-system)\n  - [Use Bin-Gem-Node annex to install the cargo completion provided with rustup](#use-bin-gem-node-annex-to-install-the-cargo-completion-provided-with-rustup)\n\n\u003c!-- mdformat-toc end --\u003e\n\n## Installation\u003ca name=\"installation\"\u003e\u003c/a\u003e\n\nLoad like a regular plugin, i.e.,:\n\n```zsh\nzi light zdharma-continuum/zinit-annex-rust\n```\n\nThis installs the annex and makes the `rustup` and `cargo''` ices available.\n\n## Usage\u003ca name=\"usage\"\u003e\u003c/a\u003e\n\nThe Zinit annex provides two new ices: `rustup` and `cargo''`. The first one installs rust inside the plugin's folder\nusing the official `rustup` installer. The second one has the following syntax:\n\n`cargo\"[name-of-the-binary-or-path \u003c-] [[!][c|N|E|O]:]{crate-name} [-\u003e {shim-script-name}]'`\n\n### Options\u003ca name=\"options\"\u003e\u003c/a\u003e\n\n| Flag | description                                                                                       |\n| ---- | ------------------------------------------------------------------------------------------------- |\n| `N`  | redirect both standard output and error to `/dev/null`                                            |\n| `E`  | redirect standard error to `/dev/null`                                                            |\n| `O`  | redirect standard output to `/dev/null`                                                           |\n| `c`  | change the current directory to the plugin's or snippet's directory before  executing the command |\n\nAs the examples showed, the name of the binary to run and the shim name are by default equal to the name of the crate.\nSpecifying `{binary-name} \u003c- …` and/or `… -\u003e {shim-name}` allows to override them.\n\n## Examples\u003ca name=\"examples\"\u003e\u003c/a\u003e\n\n### Install rust, the `lsd` crate, and a `lsd` shim exposing the binary\u003ca name=\"install-rust-the-lsd-crate-and-a-lsd-shim-exposing-the-binary\"\u003e\u003c/a\u003e\n\n```zsh\nzinit ice rustup cargo'!lsd'\nzinit load zdharma-continuum/null\n```\n\n### Install rust, the `exa` crate, and a `ls` shim exposing the `exa` binary\u003ca name=\"install-rust-the-exa-crate-and-a-ls-shim-exposing-the-exa-binary\"\u003e\u003c/a\u003e\n\n```zsh\nzi ice rustup cargo'!exa -\u003e ls'\nzi load zdharma-continuum/null\n```\n\n### Install rust and then the `exa` and `lsd` crates\u003ca name=\"install-rust-and-then-the-exa-and-lsd-crates\"\u003e\u003c/a\u003e\n\n```zsh\nzinit ice rustup cargo'exa;lsd'\nzinit load zdharma-continuum/null\n```\n\n### Installs rust and then the `exa' and `lsd' crates and exposes their binaries by altering $PATH\u003ca name=\"installs-rust-and-then-the-exa-and-lsd-crates-and-exposes-their-binaries-by-altering-path\"\u003e\u003c/a\u003e\n\n```zsh\nzinit ice rustup cargo'exa;lsd' as\"command\" pick\"bin/(exa|lsd)\"\nzinit load zdharma-continuum/null\n```\n\n### Installs rust and then the `exa` crate and creates its shim with standard error redirected to /dev/null\u003ca name=\"installs-rust-and-then-the-exa-crate-and-creates-its-shim-with-standard-error-redirected-to-devnull\"\u003e\u003c/a\u003e\n\n```zsh\nzinit ice rustup cargo'!E:exa'\nzinit load zdharma-continuum/null\n```\n\n### Install Rust and make it available globally in the system\u003ca name=\"install-rust-and-make-it-available-globally-in-the-system\"\u003e\u003c/a\u003e\n\n```zsh\nzi ice \\\n    id-as\"rust\" \\\n    wait\"0\" \\\n    lucid \\\n    rustup \\\n    as\"command\" \\\n    pick\"bin/rustc\" \\\n    atload='export CARGO_HOME=$PWD RUSTUP_HOME=$PWD/rustup'\nzi load zdharma-continuum/null\n```\n\n### Use Bin-Gem-Node annex to install the cargo completion provided with rustup\u003ca name=\"use-bin-gem-node-annex-to-install-the-cargo-completion-provided-with-rustup\"\u003e\u003c/a\u003e\n\n```zsh\nzi for \\\n    atload='\n      [[ ! -f ${ZINIT[COMPLETIONS_DIR]}/_cargo ]] \u0026\u0026 zi creinstall rust\n      export CARGO_HOME=\\$PWD RUSTUP_HOME=$PWD/rustup' \\\n    as=null \\\n    id-as=rust \\\n    lucid \\\n    rustup \\\n    sbin=\"bin/*\" \\\n    wait=1 \\\n  zdharma-continuum/null\n```\n\nWhen using a global installation of rust in turbo mode, cargos need to omit the rustup ice, and wait on `$CARGO_HOME`\nand `$RUSTUP_HOME` environment variables to be available\n\n```zsh\nzi for \\\n    wait='[[ -v CARGO_HOME \u0026\u0026 -v RUSTUP_HOME ]]' \\\n    id-as'rust-exa' \\\n    cargo'!exa' \\\n  zdharma-continuum/null\n```\n\n\u003c!-- vim:set ft=markdown --\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzdharma-continuum%2Fzinit-annex-rust","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzdharma-continuum%2Fzinit-annex-rust","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzdharma-continuum%2Fzinit-annex-rust/lists"}