Skip to content

Commit

Permalink
docs: update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
ciffelia committed Apr 14, 2024
1 parent c193474 commit aa97cfd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,12 @@ You can parse a string into a Nano ID using [`Nanoid::try_from_str`], [`std::str

```rust
use nid::Nanoid;

// From &str
let id: Nanoid = Nanoid::try_from_str("K8N4Q7MNmeHJ-OHHoVDcz")?;
let id: Nanoid = "3hYR3muA_xvjMrrrqFWxF".parse()?;

// From String
let id: Nanoid = "iH26rJ8CpRz-gfIh7TSRu".to_string().try_into()?;
```

Expand Down
4 changes: 4 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,12 @@
//!
//! ```
//! use nid::Nanoid;
//!
//! // From &str
//! let id: Nanoid = Nanoid::try_from_str("K8N4Q7MNmeHJ-OHHoVDcz")?;
//! let id: Nanoid = "3hYR3muA_xvjMrrrqFWxF".parse()?;
//!
//! // From String
//! let id: Nanoid = "iH26rJ8CpRz-gfIh7TSRu".to_string().try_into()?;
//! # Ok::<(), Box<dyn std::error::Error>>(())
//! ```
Expand Down

0 comments on commit aa97cfd

Please sign in to comment.