DOC: Add readme for crates.io and update docs

This commit is contained in:
bluss 2017-10-15 23:06:03 +02:00
parent b9d79aa014
commit 1d1398857f
3 changed files with 22 additions and 10 deletions

View File

@ -6,13 +6,11 @@ authors = ["bluss"]
license = "MIT/Apache-2.0"
repository = "https://github.com/bluss/either"
documentation = "https://docs.rs/either/1/"
readme = "README-crates.io.md"
description = """
The enum `Either`, with variants `Left` and `Right` and trait implementations including Iterator, Read, Write.
Either has methods that are similar to Option and Result.
Includes convenience macros `try_left!()` and `try_right!()` to use for short-circuiting logic."""
The enum [`Either`] with variants `Left` and `Right` is a general purpose sum type with two cases.
"""
keywords = ["data-structure", "no_std"]
categories = ["data-structures", "no-std"]

10
README-crates.io.md Normal file
View File

@ -0,0 +1,10 @@
The enum `Either` with variants `Left` and `Right` is a general purpose
sum type with two cases.
Either has methods that are similar to Option and Result, and it also implements
traits like `Iterator`.
Includes macros `try_left!()` and `try_right!()` to use for
short-circuiting logic, similar to how the `?` operator is used with `Result`.
Note that `Either` is general purpose. For describing success or error, use the
regular `Result`.

View File

@ -1,4 +1,7 @@
//! The enum [**Either**](enum.Either.html).
//! The enum [`Either`] with variants `Left` and `Right` is a general purpose
//! sum type with two cases.
//!
//! [`Either`]: enum.Either.html
//!
//! **Crate features:**
//!
@ -30,11 +33,12 @@ use std::error::Error;
pub use Either::{Left, Right};
/// `Either` represents an alternative holding one value out of
/// either of the two possible values.
/// The enum `Either` with variants `Left` and `Right` is a general purpose
/// sum type with two cases.
///
/// `Either` is a general purpose sum type of two parts. For representing
/// success or error, use the regular `Result<T, E>` instead.
/// The `Either` type is symmetric and treats its variants the same way, without
/// preference.
/// (For representing success or error, use the regular `Result` enum instead.)
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
pub enum Either<L, R> {