hyperactor_mesh/
test_utils.rs

1/*
2 * Copyright (c) Meta Platforms, Inc. and affiliates.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * LICENSE file in the root directory of this source tree.
7 */
8
9use async_trait::async_trait;
10use hyperactor::Actor;
11use hyperactor::Bind;
12use hyperactor::Context;
13use hyperactor::Handler;
14use hyperactor::Unbind;
15use serde::Deserialize;
16use serde::Serialize;
17use typeuri::Named;
18
19/// Message that can be sent to an EmptyActor.
20#[derive(Serialize, Deserialize, Debug, Named, Clone, Bind, Unbind)]
21pub struct EmptyMessage();
22
23#[derive(Debug, PartialEq, Default)]
24#[hyperactor::export(
25    spawn = true,
26    handlers = [
27        EmptyMessage { cast = true },
28    ],
29)]
30pub struct EmptyActor();
31
32impl Actor for EmptyActor {}
33
34#[async_trait]
35impl Handler<EmptyMessage> for EmptyActor {
36    async fn handle(&mut self, _: &Context<Self>, _: EmptyMessage) -> Result<(), anyhow::Error> {
37        Ok(())
38    }
39}