Skip to content

Stable ordering when generating StructMeta code #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 18, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions structmeta-derive/src/struct_meta.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::syn_utils::*;
use proc_macro2::{Span, TokenStream};
use quote::{format_ident, quote, quote_spanned};
use std::collections::HashMap;
use std::collections::BTreeMap;
use syn::{
ext::IdentExt,
parse::{Parse, ParseStream},
Expand Down Expand Up @@ -52,15 +52,15 @@ struct Params<'a> {
unnamed_required: Vec<UnnamedParam<'a>>,
unnamed_optional: Vec<UnnamedParam<'a>>,
unnamed_variadic: Option<UnnamedParam<'a>>,
named: HashMap<String, NamedParam<'a>>,
named: BTreeMap<String, NamedParam<'a>>,
rest: Option<RestParam<'a>>,
}
impl<'a> Params<'a> {
fn from_fields(fields: &'a Fields) -> Result<Self> {
let mut unnamed_required = Vec::new();
let mut unnamed_optional = Vec::new();
let mut unnamed_variadic = None;
let mut named = HashMap::new();
let mut named = BTreeMap::new();
let mut rest = None;
for (index, field) in fields.iter().enumerate() {
let span = field.span();
Expand Down