mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-21 08:26:30 +00:00
Fix all spelling mistakes in history by typos tool
This commit is contained in:
committed by
Tate, Hongliang Tian
parent
b29d3b5409
commit
86f09eef75
@ -31,5 +31,5 @@ fn main() {
|
||||
|
||||
## Introduction
|
||||
This crate provides a derive procedural macro named `TryFromInt`. This macro will automatically implement [TryFrom](https://doc.rust-lang.org/core/convert/trait.TryFrom.html) trait for enums that meet the following requirements:
|
||||
1. The enum must have a primitive repr, i.e., the enum should have attribute like #[repr(u8)], #[repr(u32)], etc. The type parameter of TryFrom will be the repr, e.g., in the `QuickStart` example, the macro will implment `TryFrom<u8>` for `Color`.
|
||||
1. The enum must have a primitive repr, i.e., the enum should have attribute like #[repr(u8)], #[repr(u32)], etc. The type parameter of TryFrom will be the repr, e.g., in the `QuickStart` example, the macro will implement `TryFrom<u8>` for `Color`.
|
||||
2. The enum must consist solely of unit variants, which is called [units only enum](https://doc.rust-lang.org/reference/items/enumerations.html#unit-only-enum). Each field should have an **explicit discriminant**.
|
||||
|
@ -69,8 +69,8 @@ fn fn_body_tokens(value_name: &str, data_enum: &DataEnum, ident: Ident) -> Token
|
||||
.discriminant
|
||||
.as_ref()
|
||||
.expect("Each field must be assigned a discriminant value explicitly");
|
||||
let vairant_ident = &variant.ident;
|
||||
let statement = quote!(#value => ::core::result::Result::Ok(#ident::#vairant_ident),);
|
||||
let variant_ident = &variant.ident;
|
||||
let statement = quote!(#value => ::core::result::Result::Ok(#ident::#variant_ident),);
|
||||
match_bodys.append_all(statement);
|
||||
}
|
||||
match_bodys.append_all(
|
||||
|
Reference in New Issue
Block a user