rf_distributed/
platform.rs

1use crate::discovery::nbr_sensors_setup::NbrSensorSetup;
2use crate::discovery::Discovery;
3use crate::mailbox::Mailbox;
4use rf_core::context::Context;
5
6pub mod asynchronous;
7pub mod sync;
8
9pub struct PlatformFactory;
10
11impl PlatformFactory {
12    pub fn sync_platform<M, N, D, S>(
13        mailbox: M,
14        network: N,
15        context: Context,
16        discovery: D,
17        setup: S,
18    ) -> sync::SyncRuFiPlatform<M, N, D, S>
19    where
20        M: Mailbox,
21        N: crate::network::sync::Network,
22        D: Discovery,
23        S: NbrSensorSetup,
24    {
25        sync::SyncRuFiPlatform::new(mailbox, network, context, discovery, setup)
26    }
27
28    pub fn async_platform<M, N, D, S>(
29        mailbox: M,
30        network: N,
31        context: Context,
32        discovery: D,
33        setup: S,
34    ) -> asynchronous::RuFiPlatform<M, N, D, S>
35    where
36        M: Mailbox,
37        N: crate::network::asynchronous::Network,
38        D: Discovery,
39        S: NbrSensorSetup,
40    {
41        asynchronous::RuFiPlatform::new(mailbox, network, context, discovery, setup)
42    }
43}