Skip to content

Commit

Permalink
remove field expose macro
Browse files Browse the repository at this point in the history
  • Loading branch information
Flemmli97 committed Dec 18, 2024
1 parent c1c2d8b commit 9f8e7e2
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 108 deletions.
75 changes: 0 additions & 75 deletions tools/macro-utils/src/field_utils.rs

This file was deleted.

33 changes: 0 additions & 33 deletions tools/macro-utils/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,41 +2,8 @@ extern crate proc_macro2;

use proc_macro::TokenStream;

mod field_utils;
mod struct_utils;

/// Implements either:
/// #values() -> &'static[#Enum] for enums that returns all defined values in the enum.
/// #fields() -> &'static[(field_name, field_type_definition)] for struct and union types that returns all defined fields.
/// E.g.
/// ```
/// use macro_utils::VariantExport;
/// #[derive(VariantExport, PartialEq, Debug)]
/// pub enum SomeEnum {
/// SomeValue1,
/// SomeValue2
/// }
///
/// assert_eq!([SomeEnum::SomeValue1, SomeEnum::SomeValue2], SomeEnum::values());
///
/// pub struct B;
///
/// #[derive(VariantExport)]
/// pub struct A {
/// x: i64,
/// y: i128,
/// z: B
/// }
///
/// assert_eq!([("x", "i64"), ("y", "i128"), ("z", "B")], A::fields());
/// ```
#[proc_macro_derive(VariantExport)]
pub fn field_values(input: TokenStream) -> TokenStream {
field_utils::expand(input)
.unwrap_or_else(|e| e.into_compile_error().into())
.into()
}

/// Implements a way to fetch all public implemented method for a given struct or trait.
/// It returns a tuple where the first element is the functions name and the second if its async
/// E.g.
Expand Down

0 comments on commit 9f8e7e2

Please sign in to comment.