Skip to content

Commit

Permalink
chore: update readme for 0.1.3
Browse files Browse the repository at this point in the history
  • Loading branch information
frectonz committed Nov 15, 2024
1 parent e40bb34 commit c6afce7
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,20 @@ cargo add parenv

## Usage

The following demonstrates a simple usage example. `parenv` relies on the `FromStr` trait to parse environment variables into the specified type.
The documentation comment on each field is used as the description for the corresponding environment variable.
To make a field optional wrap the type with an `Option`.
Here are some important features you should know about.

- `parenv` relies on the `FromStr` trait to parse environment variables into the specified type.
- The documentation comment on each field is used as the description for the corresponding environment variable.
- To make a field optional, wrap the type with an `Option`.
- To set a prefix value, set the attribute `#[parenv(prefix = "ENV_")]` on your struct.

```rust
use std::{net::SocketAddr, path::PathBuf};

use parenv::Environment;

#[derive(Debug, Environment)]
#[parenv(prefix = "ENV_")]
struct Env {
/// The cat
cat: Option<u8>,
Expand Down

0 comments on commit c6afce7

Please sign in to comment.