Skip to content
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

Move EngineConfig to a Static Global #178

Merged
merged 1 commit into from
Jul 30, 2022

Conversation

zicklag
Copy link
Member

@zicklag zicklag commented Jul 30, 2022

EngineConfig is read-only and logically makes sense as a static as it
last the life of the program, so this moves it to a global static that
can be accessed from anywhere in the program instead of just in the Bevy
world.

This is also going to be required for scripting support so that the
asset directory will be readable from asset loaders without borrowing the
Bevy world.

@zicklag zicklag requested a review from 64kramsystem July 30, 2022 18:30
EngineConfig is read-only and logically makes sense as a static as it
last the life of the program, so this moves it to a global static that
can be accessed from anywhere in the program instead of just in the Bevy
world.

This is also going to be required for scripting support so that the
asset directory will be readable from asset loaders without borrowing the
Bevy world.
Copy link
Member

@64kramsystem 64kramsystem left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 😄 (there's a typo (EGNINE) 😄)

Once Rust 1.64 is released, I think that we can get rid of once_cell, since Mutex will be const 😍

@zicklag zicklag force-pushed the engine-config-global branch from 42537c0 to 6a5cd6b Compare July 30, 2022 19:52
@zicklag
Copy link
Member Author

zicklag commented Jul 30, 2022

Wow. 🤦 Thanks for catching the typo. :)

Once Rust 1.64 is released, I think that we can get rid of once_cell, since Mutex will be const heart_eyes

Actually we don't need mutex, though, we just need the Lazy functionality to initialize the value on first access. But eventually when Lazy is stabilized, then we'd be good. :)

@zicklag
Copy link
Member Author

zicklag commented Jul 30, 2022

bors r+

@bors
Copy link
Contributor

bors bot commented Jul 30, 2022

Build succeeded:

@bors bors bot merged commit 3511b6f into fishfolk:master Jul 30, 2022
@zicklag zicklag deleted the engine-config-global branch July 30, 2022 20:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants