Skip to content

Commit

Permalink
[Improve]: Optimize binary size (#45)
Browse files Browse the repository at this point in the history
  • Loading branch information
not-elm committed May 13, 2024
1 parent a9f3df1 commit 8e1d111
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 15 deletions.
4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,11 @@ bevy_egui = "0.27.0"
bevy_progress_bar = { version = "0.9.0" }

[features]
default = ["audio"]
default = ["audio", "record", "effect"]
audio = ["bevy/bevy_audio", "bevy/bevy_asset"]
tokio = ["dep:tokio", "dep:async-compat"]
record = []
effect = []

[lints.clippy]
type_complexity = "allow"
Expand Down
33 changes: 32 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
This library provides a mechanism for more sequential description of delays, character movement,
waiting for user input, and other state waits.

As an example, here is an example of a cut-in effect that involves waiting for user input, a slight delay, and a sprite to move.
As an example, here is an example of a cut-in effect that involves waiting for user input, a slight delay, and a sprite
to move.

![cut_in](examples/cut_in.gif)

Expand Down Expand Up @@ -55,6 +56,36 @@ Please see [here](https://github.com/not-elm/bevy_flurx/blob/main/CHANGELOG.md).
| 0.3.1 | 0.13.1 |
| 0.3.2 ~ 0.5.0 | 0.13.2 |

## Feature flags

| flag name | short description | default |
|-----------|--------------------------------|---------|
| audio | audio actions | true |
| record | undo/redo actions and events | true |
| effect | thread/async side effects | true |
| tokio | async-compat and async actions | false |

### audio

Provides the actions that perform simple audio playback and waiting using bevy's default audio functionality.

- once::audio
- wait::audio

### record

Provides `Record` to manage operation history.

![undo_redo](examples/undo_redo.gif)

### effect

Allows to convert the operations with side effects such as asynchronous runtime or thread into the referential-transparent actions.

### tokio

You will be able to write processes that depend on tokio's runtime in the reactor.

## License

This crate is licensed under the MIT License or the Apache License 2.0.
4 changes: 3 additions & 1 deletion src/action.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,11 @@ pub mod seed;
pub mod through;
pub mod pipe;
pub mod sequence;
pub mod record;
pub mod omit;
#[cfg(feature = "effect")]
pub mod effect;
#[cfg(feature = "record")]
pub mod record;
#[path = "action/tuple.rs"]
mod _tuple;
mod map;
Expand Down
26 changes: 14 additions & 12 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,9 @@ pub mod runner;
pub mod prelude {
pub use crate::{
action::*,
action::effect::AsyncFunctor,
action::Map,
action::omit::*,
action::pipe::Pipe,
action::record::{
EditRecordResult,
Record,
Redo,
RedoAction,
Rollback,
Track,
Undo,
UndoRedoInProgress,
},
action::record::extension::*,
action::Remake,
action::seed::ActionSeed,
action::sequence::Then,
Expand All @@ -54,6 +42,20 @@ pub mod prelude {
runner::*,
task::ReactiveTask,
};
#[cfg(feature = "effect")]
pub use crate::action::effect::AsyncFunctor;
#[cfg(feature = "record")]
pub use crate::action::record::{
EditRecordResult,
extension::{RecordExtension, RequestRedo, RequestUndo},
Record,
Redo,
RedoAction,
Rollback,
Track,
Undo,
UndoRedoInProgress,
};
}

mod world_ptr;
Expand Down

0 comments on commit 8e1d111

Please sign in to comment.