litext 0.2.0

Just what you need for extracting string literal contents at compile time
Documentation
<div align="center">

# litext

[![Rust Version](https://img.shields.io/badge/rustc-2024%20edition-blue.svg)](https://doc.rust-lang.org/edition-guide/rust-2024/)
[![Crates.io Version](https://img.shields.io/crates/v/litext)](https://crates.io/crates/litext)
[![docs.rs](https://img.shields.io/docsrs/litext)](https://docs.rs/litext)
[![License MIT](https://img.shields.io/crates/l/litext)](https://codeberg.org/razkar/litext/src/branch/main/LICENSE-MIT)
[![License Apache-2.0](https://img.shields.io/crates/l/farben)](https://codeberg.org/razkar/litext/src/branch/main/LICENSE-APACHE)
[![Crates.io Downloads](https://img.shields.io/crates/d/litext)](https://crates.io/crates/litext)
[![Deps.rs](https://deps.rs/repo/codeberg/razkar/litext/status.svg)](https://deps.rs/repo/codeberg/razkar/litext)
[![Maintenance](https://img.shields.io/badge/maintenance-actively--developed-brightgreen)](https://codeberg.org/razkar/litext)

A lightweight procedural macro library for extracting string literal contents from tokens. Built for proc-macro authors.

</div>

## What is this?

Litext provides a macro to extract the inner text from a string literal token. You pass raw tokens to `litext!` and it gives you back the unwrapped string content without the quotes.

This is a proc-macro helper library. It is designed for proc-macro authors who need to extract string content from TokenStream input during macro expansion without the bloat.

Zero dependencies, tiny, built for proc-macro authors.

## Installation

Add `litext` to project:

```sh
cargo add litext
```

## Quick Start

```rust
use litext::{litext, TokenStream};

pub fn my_macro(input: TokenStream) -> TokenStream {
    let string_content: String = litext!(input);
    // ... use string_content
}
```

## Features

- Extract string content from TokenStream tokens
- Support for regular strings: `"hello world"`
- Support for raw strings: `r#"hello world"#`
- Support for raw strings with multiple hashes: `r##"hello #" world"##`
- Clear error messages for invalid inputs
- Zero runtime dependencies

## Requirements

- Rust 2024 edition
- A proc-macro crate (this library is for macro authors, not end users)

## License

Licensed under either of:
- Apache License, Version 2.0, ([LICENSE-APACHE]LICENSE-APACHE or <http://www.apache.org/licenses/LICENSE-2.0>)
- MIT license ([LICENSE-MIT]LICENSE-MIT or <http://opensource.org/licenses/MIT>)

at your option.

Cheers, RazkarStudio
© 2026 RazkarStudio. All rights reserved.