From 300505e7305a2fdac722a808ee8538323f215f39 Mon Sep 17 00:00:00 2001 From: Joshua Yanovski Date: Thu, 20 Aug 2020 18:46:25 +0200 Subject: [PATCH] Fixing cargo doc and typo in CHANGELOG. --- CHANGELOG.md | 2 +- common/src/typed.rs | 30 +++++++++++++++++++----------- 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ddc57ba206..55245f8670 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,7 +25,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Removed -- MSAAA has been removed due to incompatibility with greeddy meshing. +- MSAA has been removed due to incompatibility with greedy meshing. - Removed a saturation hack that led to colors being improperly displayed. ## [0.7.0] - 2020-08-15 diff --git a/common/src/typed.rs b/common/src/typed.rs index a5879f0600..1dbf98f069 100644 --- a/common/src/typed.rs +++ b/common/src/typed.rs @@ -41,13 +41,16 @@ impl, T, S> Typed, S> for T { /// [make_case_elim!], as follows: /// /// ``` -/// make_case_elim!( +/// # #![feature(arbitrary_enum_discriminant)] +/// # #[macro_use] extern crate veloren_common; +/// +/// veloren_common::make_case_elim!( /// my_type_module, /// #[repr(u32)] -/// #[derive(Clone,Copy,OtherAttribs)] +/// #[derive(Clone,Copy)] /// pub enum MyType { /// Constr1 = 0, -/// Constr2(arg : ArgType) = 1, +/// Constr2(arg : u8) = 1, /// /* ..., */ /// } /// ); @@ -59,15 +62,20 @@ impl, T, S> Typed, S> for T { /// few things. In this case: /// /// ``` +/// # #![feature(arbitrary_enum_discriminant)] +/// # #[macro_use] extern crate veloren_common; +/// /// #[repr(u32)] -/// #[derive(Clone,Copy,OtherAttribs)] +/// #[derive(Clone, Copy)] /// pub enum MyType { /// Constr1 = 0, -/// Constr2(arg : ArgType) = 1, +/// Constr2(u8) = 1, /// /* ..., */ /// } /// -/// mod make_case_elim { +/// # #[allow(non_snake_case)] +/// # #[allow(dead_code)] +/// mod my_type_module { /// use ::serde::{Deserialize, Serialize}; /// /// /// The number of variants in this enum. @@ -75,7 +83,7 @@ impl, T, S> Typed, S> for T { /// /// /// An array of all the variant indices (in theory, this can be used by this or other /// /// macros in order to easily build up things like uniform random samplers). -/// pub const ALL_INDICES: [u32; NUM_VARIANTS] = [ 0, 1 ]; +/// pub const ALL_INDICES: [u32; NUM_VARIANTS] = [0, 1]; /// /// /// A convenience trait used to store a different type for each constructor in this /// /// pattern. @@ -92,14 +100,14 @@ impl, T, S> Typed, S> for T { /// /// the [Elim] argument. Each field has the same name as the constructor it represents. /// #[derive(Serialize, Deserialize)] /// pub struct Cases { -/// pub constr: Elim::Constr1, -/// pub constr: Elim::Constr2, +/// pub Constr1: Elim::Constr1, +/// pub Constr2: Elim::Constr2, /// } /// /// /// Finally, because it represents by an overwhelming margin the most common usecase, we /// /// predefine a particular pattern matching strategy--"pure"--where every arm holds data of /// /// the exact same type, T. -/// impl PackedElim for typed::Pure { +/// impl PackedElim for veloren_common::typed::Pure { /// type Constr1 = T; /// type Constr2 = T; /// } @@ -107,7 +115,7 @@ impl, T, S> Typed, S> for T { /// /// Because PureCases is so convenient, we have an alias for it. Thus, in order to /// /// represent a pattern match on an argument that returns a constant of type (u8,u8,u8) for /// /// each arm, you'd use the type `PureCases<(u8, u8, u8)>`. -/// pub type PureCases = Cases<$crate::typed::Pure>; +/// pub type PureCases = Cases>; /// } /// ``` ///