Skip to content

Commit

Permalink
Add example to root module docs
Browse files Browse the repository at this point in the history
  • Loading branch information
sfackler committed Feb 18, 2015
1 parent bfc36c9 commit fbbb530
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions phf/src/lib.rs
Expand Up @@ -2,6 +2,37 @@
//!
//! Keys can be string literals, byte string literals, byte literals, char
//! literals, or any of the fixed-size isizeegral types.
//!
//! # Examples
//!
//! ```rust
//! #![feature(plugin)]
//! #![plugin(phf_macros)]
//!
//! extern crate phf;
//!
//! #[derive(Clone)]
//! pub enum Keyword {
//! Loop,
//! Continue,
//! Break,
//! Fn,
//! Extern,
//! }
//!
//! static KEYWORDS: phf::Map<&'static str, Keyword> = phf_map! {
//! "loop" => Keyword::Loop,
//! "continue" => Keyword::Continue,
//! "break" => Keyword::Break,
//! "fn" => Keyword::Fn,
//! "extern" => Keyword::Extern,
//! };
//!
//! pub fn parse_keyword(keyword: &str) -> Option<Keyword> {
//! KEYWORDS.get(keyword).map(|t| t.clone())
//! }
//! # fn main() {}
//! ```
#![doc(html_root_url="https://sfackler.github.io/rust-phf/doc")]
#![feature(core, no_std)]
#![warn(missing_docs)]
Expand Down

0 comments on commit fbbb530

Please sign in to comment.