Give Derive enum and impls their own module
diff --git a/syntax/attrs.rs b/syntax/attrs.rs
index 1cb0657..f48a210 100644
--- a/syntax/attrs.rs
+++ b/syntax/attrs.rs
@@ -1,6 +1,5 @@
use crate::syntax::report::Errors;
use crate::syntax::{Derive, Doc};
-use proc_macro2::Ident;
use syn::parse::{ParseStream, Parser as _};
use syn::{Attribute, Error, LitStr, Path, Result, Token};
@@ -70,22 +69,3 @@
})
.collect()
}
-
-impl Derive {
- pub fn from(ident: &Ident) -> Option<Self> {
- match ident.to_string().as_str() {
- "Clone" => Some(Derive::Clone),
- "Copy" => Some(Derive::Copy),
- _ => None,
- }
- }
-}
-
-impl AsRef<str> for Derive {
- fn as_ref(&self) -> &str {
- match self {
- Derive::Clone => "Clone",
- Derive::Copy => "Copy",
- }
- }
-}
diff --git a/syntax/derive.rs b/syntax/derive.rs
new file mode 100644
index 0000000..435aa20
--- /dev/null
+++ b/syntax/derive.rs
@@ -0,0 +1,26 @@
+use proc_macro2::Ident;
+
+#[derive(Copy, Clone, PartialEq)]
+pub enum Derive {
+ Clone,
+ Copy,
+}
+
+impl Derive {
+ pub fn from(ident: &Ident) -> Option<Self> {
+ match ident.to_string().as_str() {
+ "Clone" => Some(Derive::Clone),
+ "Copy" => Some(Derive::Copy),
+ _ => None,
+ }
+ }
+}
+
+impl AsRef<str> for Derive {
+ fn as_ref(&self) -> &str {
+ match self {
+ Derive::Clone => "Clone",
+ Derive::Copy => "Copy",
+ }
+ }
+}
diff --git a/syntax/mod.rs b/syntax/mod.rs
index 9e4cbbc..d21c083 100644
--- a/syntax/mod.rs
+++ b/syntax/mod.rs
@@ -3,6 +3,7 @@
pub mod atom;
mod attrs;
pub mod check;
+mod derive;
mod doc;
pub mod error;
pub mod ident;
@@ -23,6 +24,7 @@
use syn::{Lifetime, LitStr, Token, Type as RustType};
pub use self::atom::Atom;
+pub use self::derive::Derive;
pub use self::doc::Doc;
pub use self::parse::parse_items;
pub use self::types::Types;
@@ -145,9 +147,3 @@
Cxx,
Rust,
}
-
-#[derive(Copy, Clone, PartialEq)]
-pub enum Derive {
- Clone,
- Copy,
-}