
# Objective - A preparation for the 'system as entities' - The current system has a series of states such as `is_send`, `is_exclusive`, `has_defered`, As `system as entites` landed, it may have more states. Using Bitflags to unify all states is a more concise and performant approach ## Solution - Using Bitflags to unify system state.
673 B
673 B
title | pull_requests | |
---|---|---|
Unified system state flag |
|
Now the system have a unified SystemStateFlags
to represent its different states.
If your code previously looked like this:
impl System for MyCustomSystem {
// ...
fn is_send(&self) -> bool {
false
}
fn is_exclusive(&self) -> bool {
true
}
fn has_deferred(&self) -> bool {
false
}
// ....
}
You should migrate it to:
impl System for MyCustomSystem{
// ...
fn flags(&self) -> SystemStateFlags {
// non-send , exclusive , no deferred
SystemStateFlags::NON_SEND | SystemStateFlags::EXCLUSIVE
}
// ...
}