From 460700124a98c80f90ffbe7b4368e27037bdce29 Mon Sep 17 00:00:00 2001 From: Peter Glotfelty Date: Sun, 12 Feb 2017 12:52:51 -0800 Subject: [PATCH] Update README.md Fixed the link on the readme and removed some of the lines that rustdoc parses differently than a standard markdown parser --- README.md | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 7831b9d..0e98037 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ [![Build Status](https://travis-ci.org/Peternator7/strum.svg?branch=master)](https://travis-ci.org/Peternator7/strum) [![Latest Version](https://img.shields.io/crates/v/strum.svg)](https://crates.io/crates/strum) -[![Rust Documentation](https://img.shields.io/badge/api-rustdoc-blue.svg)](https://docs.rs/strum/badge.svg) +[![Rust Documentation](https://img.shields.io/badge/api-rustdoc-blue.svg)](https://docs.rs/strum) Strum is a set of macros and traits for working with enums and strings easier in Rust. @@ -25,7 +25,6 @@ And add these lines to the root of your project, either lib.rs or main.rs. extern crate strum; #[macro_use] extern crate strum_macros; -# fn main() {} ``` # Strum Macros @@ -43,8 +42,8 @@ Strum has implemented the following macros: Here is an example of the code generated by deriving `EnumString`. ``` - # extern crate strum; - # #[macro_use] extern crate strum_macros; + extern crate strum; + #[macro_use] extern crate strum_macros; #[derive(EnumString)] enum Color { Red, @@ -76,7 +75,6 @@ Strum has implemented the following macros: } } */ - # fn main() {} ``` Note that the implementation of `FromStr` only matches on the name of the variant. @@ -91,9 +89,6 @@ Strum has implemented the following macros: create [unbounded lifetimes] (https://doc.rust-lang.org/nightly/nomicon/unbounded-lifetimes.html). ```rust - # extern crate strum; - # #[macro_use] extern crate strum_macros; - # use std::fmt::Debug; // You need to bring the type into scope to use it!!! use strum::IntoEnumIterator; @@ -126,8 +121,6 @@ Strum has implemented the following macros: The generated code will look something like: ```rust - # extern crate strum; - # #[macro_use] extern crate strum_macros; // You need to bring the type into scope to use it!!! use strum::EnumMessage; @@ -178,7 +171,6 @@ Strum has implemented the following macros: } } */ - # fn main() {} ``` # Additional Attributes @@ -220,8 +212,8 @@ Using `EnumMessage` for quickly implementing `Error` extern crate strum; #[macro_use] extern crate strum_macros; -# use std::error::Error; -# use std::fmt::*; +use std::error::Error; +use std::fmt::*; use strum::EnumMessage; #[derive(Debug, EnumMessage)] @@ -245,7 +237,6 @@ impl Error for ServerError { self.get_detailed_message().unwrap() } } -# fn main() {} ``` Using `EnumString` to tokenize a series of inputs: @@ -285,4 +276,4 @@ fn main() { Strum is short for STRing enUM because it's a library for augmenting enums with additional information through strings. -Strumming is also a very whimsical motion, much like writing Rust code. \ No newline at end of file +Strumming is also a very whimsical motion, much like writing Rust code.