Skip to content
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
48 changes: 3 additions & 45 deletions src/idents.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::fmt::Display;
use quote::ToTokens;
use syn::Ident;

#[derive(Clone)]
#[derive(Clone, PartialEq, Eq, Hash)]
pub struct ContainerIdent(pub Ident);

impl Display for ContainerIdent {
Expand All @@ -12,66 +12,24 @@ impl Display for ContainerIdent {
}
}

impl PartialEq for ContainerIdent {
fn eq(&self, other: &Self) -> bool {
self.0 == other.0
}
}

impl Eq for ContainerIdent {}

impl std::hash::Hash for ContainerIdent {
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
self.0.hash(state);
}
}

impl ToTokens for ContainerIdent {
fn to_tokens(&self, tokens: &mut proc_macro2::TokenStream) {
self.0.to_tokens(tokens);
}
}

#[derive(Clone)]
#[derive(Clone, PartialEq, Eq, Hash)]
pub struct VariantIdent(pub Ident);

impl PartialEq for VariantIdent {
fn eq(&self, other: &Self) -> bool {
self.0 == other.0
}
}

impl Eq for VariantIdent {}

impl std::hash::Hash for VariantIdent {
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
self.0.hash(state);
}
}

impl ToTokens for VariantIdent {
fn to_tokens(&self, tokens: &mut proc_macro2::TokenStream) {
self.0.to_tokens(tokens);
}
}

#[derive(Clone)]
#[derive(Clone, PartialEq, Eq, Hash)]
pub struct FieldIdent(pub Ident);

impl PartialEq for FieldIdent {
fn eq(&self, other: &Self) -> bool {
self.0 == other.0
}
}

impl Eq for FieldIdent {}

impl std::hash::Hash for FieldIdent {
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
self.0.hash(state);
}
}

impl ToTokens for FieldIdent {
fn to_tokens(&self, tokens: &mut proc_macro2::TokenStream) {
self.0.to_tokens(tokens);
Expand Down