litext 1.3.0

Seamless proc-macro literal extraction.
Documentation
//! Span-aware literal types, the [`FromLit`] extraction trait, and the
//! [`ToTokens`] round-trip trait.
//!
//! Each span-aware type bundles a parsed value with its source location so
//! diagnostics can point at the exact literal in the user's code.
//!
//! ## Span-Aware Types
//!
//! | Plain type | Span-aware type | Literal kind |
//! |------------|-----------------|--------------|
//! | `String` | [`LitStr`] | `"..."`, `r#"..."#` |
//! | `i8`–`i128`, `isize`, `usize` | [`LitInt<T>`](LitInt) | `42`, `0xFF`, `0b1010` |
//! | `f32`, `f64` | [`LitFloat<T>`](LitFloat) | `3.14`, `1e10` |
//! | `bool` | [`LitBool`] | `true`, `false` |
//! | `char` | [`LitChar`] | `'a'`, `'\n'` |
//! | `u8` | [`LitByte`] | `b'a'`, `b'\xff'` |
//! | `Vec<u8>` | [`LitByteStr`] | `b"..."`, `br#"..."#` |
//! | `CString` | [`LitCStr`] | `c"..."`, `cr#"..."#` |
//!
//! ## Round-Tripping
//!
//! All span-aware types implement [`ToTokens`], so you can extract, validate,
//! and emit a literal back into your macro output with the original span preserved:
//!
//! ```ignore
//! use litext::literal::{LitStr, ToTokens};
//!
//! let lit: LitStr = extract(input)?;
//! if lit.value().is_empty() {
//!     return Err(comperr::error(lit.span(), "string cannot be empty"));
//! }
//! lit.to_token_stream()
//! ```
//!
//! ## See Also
//!
//! - [`FromLit`] for implementing custom literal extraction
//! - [`crate::extract`] for the function that drives extraction
//! - [`crate::litext`] for the macro that wraps it

mod str;
pub use str::*;

mod fromlit;
pub use fromlit::*;

mod totokens;
pub use totokens::*;