procenv_macro 0.1.6

Procedural macro implementation for procenv
Documentation

procenv_macro

Procedural macro implementation for the procenv crate.

This crate provides the #[derive(EnvConfig)] procedural macro that generates code for loading configuration from environment variables. It is a proc-macro crate and can only export procedural macros.

Note: Users should depend on the procenv crate, not this one directly. The procenv crate re-exports this macro along with runtime types.

Module Structure

  • parse - Attribute parsing for #[env(...)] and #[env_config(...)]
  • field - Field type processing and code generation strategies
  • expand - Macro expansion orchestration and code generation

Generated Code

The macro generates the following methods on the annotated struct:

Method Description
from_env() Load from environment variables
from_env_with_sources() Load with source attribution
from_config() Load from files + env (requires file feature)
from_args() Load from CLI + env (requires CLI attributes)
env_example() Generate .env.example template

It also generates a custom Debug implementation that masks secret fields.