-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(engine): optional stream for behaviors (#899)
* feat: optional stream and default impl * test: no-stream
- Loading branch information
1 parent
267c776
commit 0522476
Showing
3 changed files
with
58 additions
and
11 deletions.
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
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,28 @@ | ||
use arbiter_engine::{agent::Agent, world::World}; | ||
|
||
include!("common.rs"); | ||
|
||
#[derive(Debug, Deserialize, Serialize)] | ||
struct MockBehavior; | ||
|
||
#[async_trait::async_trait] | ||
impl Behavior<()> for MockBehavior { | ||
async fn startup( | ||
&mut self, | ||
_client: Arc<ArbiterMiddleware>, | ||
_messager: Messager, | ||
) -> Result<Option<EventStream<()>>> { | ||
Ok(None) | ||
} | ||
} | ||
|
||
#[tokio::test] | ||
async fn behavior_no_stream() { | ||
trace(); | ||
let mut world = World::new("test"); | ||
let behavior = MockBehavior; | ||
let agent = Agent::builder("agent").with_behavior(behavior); | ||
world.add_agent(agent); | ||
|
||
world.run().await.unwrap(); | ||
} |