Move config to lazy_lock and into own crate #68
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Please take a look at the LazyLock docs docs first, because they're a relatively new feature and a few people in the discord confused it with something else.
TL;DR it's basically
lazy_static
but in std.Moving the config to LazyLock has a few advantages:
Just write
BASIC_CONFIG.<config option>
and you're good.LazyLock
once the config is initializedDownsides:
pumpkin-core
if we want to access it from the config and whatever crate we're modifying.This was one of the main points why people were
LazyLock
,however I don't think that's a problem for this specific case of storing the config because
considering the servers startup time and emphasis on performance
This PR would make it significantly easier for me to write the superflat WorldGen config.
That's because I'd have to pass the config through ~4 methods to get it to the constructor of the worldgen +
I'd need to change the
GeneratorInit
trait to take a seed and the config.All of the commits compile individually and were checked with