Support `use` in procmacros hygienically

Overview

Use statements in quote!

Crates.io Version Live Build Status Docs.rs Documentation

Description

Macro to simplify using Types in the quote! macro.

Usage

The quote_use! macro can be used just like quote!, but with the added functionality of adding use statements at the top:

quote_use!{
    use std::fs::read;
    
    read("src/main.rs")
}

This will expand to the equivalent statement using quote!:

quote!{
    ::std::fs::read::read("src/main.rs")
}

Prelude

This also allows to use contents of the rust prelude directly:

quote_use!{
    Some("src/main.rs")
}

Overriding prelude

When you want to use your own type instead of the prelude type this can be achieved by simply importing it like so

quote_use!{
    use anyhow::Result;
                                                                                                             
    Result
}

Different preludes

By default quote_use! uses the std prelude for 2021 edition, but this can be configured via features, and also completely disabled.

Other quote macros

There are also variants for other quote macros from syn and quote:

You might also like...
A TUI for your todos built in Rust with full CLI support.

todui TUI Features This app allows for almost anythig you would need when dealing with todos: Create, edit, and delete tasks Add links to tasks Add du

Holo is a suite of routing protocols designed to support high-scale and automation-driven networks.

Holo is a suite of routing protocols designed to support high-scale and automation-driven networks. For a description of what a routing protocol is, p

Automate your business flows, support, change tickets with Automatdeck
Automate your business flows, support, change tickets with Automatdeck

Automatdeck agent Website: https://automatdeck.com Documentation: https://doc.automatdeck.com Automatdeck agent is a simple lightweight IT automation

Cross-platform pseudoterminal (PTY/ConPTY) implementation with async support

pseudoterminal The pseudoterminal crate is a versatile pseudoterminal (PTY) implementation designed for Rust, offering asynchronous capabilities. This

Touch support for SDFE(Wacca).

Toucca Touch support for WACCA(SDFE). English | 简体中文 Setup Assuming you already have the game process running and working keyboard input (Being able t

LaTeX support for Typst, powered by Rust and WASM.
LaTeX support for Typst, powered by Rust and WASM.

MiTeX LaTeX support for Typst, powered by Rust and WASM. MiTeX processes LaTeX code into an abstract syntax tree (AST). Then it transforms the AST int

Cross-platform casting SDK, support Android, Windows, Linux

mirror Cross-platform casting SDK, support Android, Windows, Linux Low-latency transport protocols use [SRT](https://github.com/Haivision/srt) Video:

Meta framework. Support for dynamic plug-ins and AOP

Kokoro Dynamic publish-subscribe pattern framework. Support for dynamic plug-ins and AOP Not yet stable, do not use in production !! 下面的内容有些老旧了,但是 exa

Call is an easy-to-use command tools for remote development.
Call is an easy-to-use command tools for remote development.

Call is an easy-to-use command tools for remote development. It helps you to build remote development easily and elegant. It can work with makefile and justfile.

Owner
Roland Fredenhagen
Also on GitLab: https://gitlab.com/ModProg Sometimes I stream Development on Twitch: https://twitch.tv/modprog
Roland Fredenhagen
A Rust-based shell script to create a folder structure to use for a single class every semester. Mostly an excuse to use Rust.

A Rust Course Folder Shell Script PROJECT IN PROGRESS (Spring 2022) When completed, script will create a folder structure of the following schema: [ro

Sebastián Romero Cruz 1 Apr 10, 2022
🖥 A feature rich terminal UI file transfer and explorer with support for SCP/SFTP/FTP/S3

?? A feature rich terminal UI file transfer and explorer with support for SCP/SFTP/FTP/S3

Christian Visintin 574 Jan 5, 2023
Detects whether a terminal supports color, and gives details about that support

Detects whether a terminal supports color, and gives details about that support. It takes into account the NO_COLOR environment variable. This crate i

Kat Marchán 30 Dec 29, 2022
Rust crate to enable ANSI escape code support on Windows.

enable-ansi-support: Enable ANSI escape code support on Windows 10 About This crate provides one function, enable_ansi_support, which allows ANSI esca

Rain 9 Nov 18, 2022
A minimal readline with multiline and async support

RustyLine Async A minimal readline with multiline and async support. Inspired by rustyline , async-readline & termion-async-input.

Zyansheep 16 Dec 15, 2022
DeFiChain octopus is a codename research & development for DFIP 2111-B: VOC: Ethereum Virtual Machine (EVM) Support.

DeFiCh/octopus DeFiChain octopus is a codename research & development for DFIP 2111-B: VOC: Ethereum Virtual Machine (EVM) Support . Proposed as a DFI

DeFi Meta Chain 6 Apr 18, 2022
Generate a vanity address (`juno1wynd...`) to show your support for WYND DAO

WYND Generator When you generate a new mnemonic, it is very random (must be to be secure), and you cannot predict the address you will get. However, i

null 9 Dec 8, 2022
🏭 Convert Markdown documents into themed HTML pages with support for code syntax highlighting, LaTeX and Mermaid diagrams.

Marky Markdown Magician ?? Features Hot reload previewing ?? Conversion to HTML / PDF ?? Themes! ✨ Extensions - Math, diagrams, syntax-highlighting ??

Vadim 12 Feb 19, 2023
Fallible allocation support for Rust's Vec

Fallible allocation functions for Vec Fallible allocation functions for the Rust standard library's alloc::vec::Vec type. These functions are designed

Microsoft 4 Mar 14, 2023
Translation support for mdbook. The plugins here give you a structured way to maintain a translated book.

Gettext Translation Support for mdbook The plugins here makes it easy to translate documentation written in mdbook into multiple languages. Support fo

Google 19 Apr 5, 2023