-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
33 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
use std::fmt::Display; | ||
|
||
use bevy::prelude::*; | ||
use bevy_butler::*; | ||
|
||
use crate::common::log_plugin; | ||
|
||
#[butler_plugin] | ||
struct MyPlugin; | ||
|
||
#[derive(Resource)] | ||
#[resource(plugin = MyPlugin, init = GenericRes(5u8))] | ||
struct GenericRes<T>(T); | ||
|
||
fn generic_pipe<T: 'static + Sync + Send + Display>(res: Res<GenericRes<T>>) -> String { | ||
res.0.to_string() | ||
} | ||
|
||
#[system(plugin = MyPlugin, schedule = Startup, pipe_in = generic_pipe::<u8>)] | ||
fn print_res(input: In<String>) { | ||
info!("Generic resource: {}", input.0); | ||
assert_eq!(input.0, "5"); | ||
} | ||
|
||
#[test] | ||
fn test() { | ||
App::new() | ||
.add_plugins(log_plugin()) | ||
.add_plugins(MyPlugin) | ||
.run(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,3 +7,4 @@ mod system; | |
mod system_expr_schedule; | ||
mod use_declaration; | ||
mod pipe; | ||
mod generic_pipe; |