Skip to content

Pull bevy_ecs::label out into its own separate crate #17713

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

Open
ItsDoot opened this issue Feb 7, 2025 · 5 comments · May be fixed by #18059
Open

Pull bevy_ecs::label out into its own separate crate #17713

ItsDoot opened this issue Feb 7, 2025 · 5 comments · May be fixed by #18059
Labels
A-ECS Entities, components, systems, and events C-Usability A targeted quality-of-life change that makes Bevy easier to use D-Straightforward Simple bug fixes and API improvements, docs, test and examples S-Ready-For-Implementation This issue is ready for an implementation PR. Go for it!

Comments

@ItsDoot
Copy link
Contributor

ItsDoot commented Feb 7, 2025

What problem does this solve or what need does it fill?

The label infrastructure that bevy_ecs provides is not actually dependent on anything ECS-related, and could find use as a separate crate from bevy_ecs.

What solution would you like?

Introduce a bevy_label crate that holds everything currently defined in bevy_ecs::label.

What alternative(s) have you considered?

Leave it as-is.

@ItsDoot ItsDoot added A-ECS Entities, components, systems, and events C-Code-Quality A section of code that is hard to understand or change D-Straightforward Simple bug fixes and API improvements, docs, test and examples S-Ready-For-Implementation This issue is ready for an implementation PR. Go for it! labels Feb 7, 2025
@ilyvion
Copy link
Contributor

ilyvion commented Feb 9, 2025

It feels odd to me that this is marked with both C-Code-Quality A section of code that is hard to understand or change , described as "A section of code that is hard to understand or change" and D-Straightforward Simple bug fixes and API improvements, docs, test and examples , described as "Simple bug fixes and API improvements, docs, test and examples."

Is it hard to understand or change; or is it simple?

@ItsDoot ItsDoot added C-Usability A targeted quality-of-life change that makes Bevy easier to use and removed C-Code-Quality A section of code that is hard to understand or change labels Feb 20, 2025
@hukasu
Copy link
Contributor

hukasu commented Feb 26, 2025

i actually uses bevy_ecs::intern

fn intern(&self) -> $crate::intern::Interned<dyn $label_trait_name>
where Self: Sized {
$interner_name.intern(self)
}
}
#[diagnostic::do_not_recommend]
impl $label_trait_name for $crate::intern::Interned<dyn $label_trait_name> {

@ItsDoot
Copy link
Contributor Author

ItsDoot commented Feb 26, 2025

Yea, we would pull out bevy_ecs::intern into the new crate as well. It's only used by labels presently.

@hukasu
Copy link
Contributor

hukasu commented Feb 26, 2025

it is also used on the derive macros

pub fn derive_schedule_label(input: TokenStream) -> TokenStream {
let input = parse_macro_input!(input as DeriveInput);
let mut trait_path = bevy_ecs_path();
trait_path.segments.push(format_ident!("schedule").into());
let mut dyn_eq_path = trait_path.clone();
trait_path
.segments
.push(format_ident!("ScheduleLabel").into());
dyn_eq_path.segments.push(format_ident!("DynEq").into());
derive_label(input, "ScheduleLabel", &trait_path, &dyn_eq_path)
}
/// Derive macro generating an impl of the trait `SystemSet`.
///
/// This does not work for unions.
#[proc_macro_derive(SystemSet)]
pub fn derive_system_set(input: TokenStream) -> TokenStream {
let input = parse_macro_input!(input as DeriveInput);
let mut trait_path = bevy_ecs_path();
trait_path.segments.push(format_ident!("schedule").into());
let mut dyn_eq_path = trait_path.clone();
trait_path.segments.push(format_ident!("SystemSet").into());
dyn_eq_path.segments.push(format_ident!("DynEq").into());
derive_label(input, "SystemSet", &trait_path, &dyn_eq_path)
}

@hukasu
Copy link
Contributor

hukasu commented Feb 26, 2025

i already reached a working solution, just not that happy with it

@hukasu hukasu linked a pull request Feb 26, 2025 that will close this issue
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-ECS Entities, components, systems, and events C-Usability A targeted quality-of-life change that makes Bevy easier to use D-Straightforward Simple bug fixes and API improvements, docs, test and examples S-Ready-For-Implementation This issue is ready for an implementation PR. Go for it!
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants