Skip to content

Commit

Permalink
Release 1.0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
DasLixou committed Dec 26, 2022
1 parent 2621993 commit 151c56b
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 8 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 1.0.3

* Make generated MarkerData having same visibility as `EntityMarker` struct.

# 1.0.2

* Rename `#[marker]` to `#[entity_marker]` due to nameing problems
Expand Down
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "bevy_ecs_markers"
version = "1.0.2"
version = "1.0.3"
edition = "2021"
authors = ["DasLixou"]
description = "🏷️ Markers for Bevy ECS Entities"
Expand All @@ -12,7 +12,7 @@ exclude = ["examples"]

[dependencies]
bevy_ecs = "0.9.1"
bevy_ecs_markers_macros = { path = "macros", version = "1.0.2", optional = true }
bevy_ecs_markers_macros = { path = "macros", version = "1.0.3", optional = true }
bevy = { version = "0.9.1", optional = true }

[features]
Expand Down
2 changes: 1 addition & 1 deletion examples/single_marker/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use bevy_ecs_markers::{

#[derive(EntityMarker)]
#[entity_marker(data_name = "CurrentPlayerMarker")]
struct CurrentPlayer;
pub struct CurrentPlayer;

#[derive(Component)]
struct Player(u32);
Expand Down
2 changes: 1 addition & 1 deletion macros/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "bevy_ecs_markers_macros"
version = "1.0.2"
version = "1.0.3"
edition = "2021"
authors = ["DasLixou"]
description = "Proc Macros for Bevy ECS Markers"
Expand Down
11 changes: 7 additions & 4 deletions macros/src/entity_marker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ pub fn parse_entity_marker_derive(input: TokenStream) -> TokenStream {

let span = input.span();

let visibility = &input.vis;
let name = &input.ident;
let generics = &input.generics;
let (impl_generics, ty_generics, where_clause) = generics.split_for_impl();
Expand All @@ -36,9 +37,9 @@ pub fn parse_entity_marker_derive(input: TokenStream) -> TokenStream {

// Marker Data Implementation
let marker_data = match input.data {
syn::Data::Struct(_) => default_single_marker_impl(name, marker_name),
syn::Data::Struct(_) => default_single_marker_impl(visibility, name, marker_name),

syn::Data::Enum(d) => default_value_marker_impl(span, d, name, marker_name),
syn::Data::Enum(d) => default_value_marker_impl(visibility, span, d, name, marker_name),

syn::Data::Union(_) => quote_spanned! {
span => compile_error!("Unions cannot be used as Markers.");
Expand Down Expand Up @@ -93,6 +94,7 @@ fn parse_marker_attr(ast: &DeriveInput, mut attrs: Attrs) -> Result<Attrs> {
}

fn default_single_marker_impl(
visibility: impl ToTokens,
name: impl ToTokens,
marker_name: impl ToTokens,
) -> quote::__private::TokenStream {
Expand All @@ -102,7 +104,7 @@ fn default_single_marker_impl(

quote! {
#[derive(#resource_path)]
struct #marker_name (#entity_path);
#visibility struct #marker_name (#entity_path);

impl bevy_ecs_markers::SingleMarkerData<#name> for #marker_name {
#[inline(always)]
Expand Down Expand Up @@ -145,6 +147,7 @@ fn default_single_marker_impl(
}

fn default_value_marker_impl(
visibility: impl ToTokens,
span: Span,
d: DataEnum,
name: impl ToTokens,
Expand Down Expand Up @@ -178,7 +181,7 @@ fn default_value_marker_impl(

quote! {
#[derive(#resource_path)]
struct #marker_name ([#entity_path; #capacity]);
#visibility struct #marker_name ([#entity_path; #capacity]);

impl bevy_ecs_markers::ValueMarkerData<#name> for #marker_name {
#[inline(always)]
Expand Down

0 comments on commit 151c56b

Please sign in to comment.