mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 11:01:01 +00:00
orchestra license headers (#5588)
This commit is contained in:
committed by
GitHub
parent
fd51ecbe70
commit
032d623e8c
@@ -0,0 +1,38 @@
|
||||
#![allow(dead_code)]
|
||||
|
||||
use orchestra::*;
|
||||
|
||||
#[derive(Default)]
|
||||
struct AwesomeSubSys;
|
||||
|
||||
#[derive(Default)]
|
||||
struct AwesomeSubSys2;
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
struct SigSigSig;
|
||||
|
||||
struct Event;
|
||||
|
||||
#[derive(Clone)]
|
||||
struct MsgStrukt(u8);
|
||||
|
||||
#[orchestra(signal=SigSigSig, event=Event, gen=AllMessages, error=OrchestraError)]
|
||||
struct Orchestra {
|
||||
#[subsystem(MsgStrukt)]
|
||||
sub0: AwesomeSubSys,
|
||||
|
||||
#[subsystem(MsgStrukt)]
|
||||
sub1: AwesomeSubSys2,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
struct DummySpawner;
|
||||
|
||||
struct DummyCtx;
|
||||
|
||||
fn main() {
|
||||
let orchestra = Orchestra::<_,_>::builder()
|
||||
.sub0(AwesomeSubSys::default())
|
||||
.spawner(DummySpawner)
|
||||
.build(|| -> DummyCtx { DummyCtx } );
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
error[E0119]: conflicting implementations of trait `orchestra::SubsystemSender<MsgStrukt>` for type `OrchestraSubsystemSender`
|
||||
--> tests/ui/err-01-duplicate-consumer.rs:19:1
|
||||
|
|
||||
19 | #[orchestra(signal=SigSigSig, event=Event, gen=AllMessages, error=OrchestraError)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
| |
|
||||
| first implementation here
|
||||
| conflicting implementation for `OrchestraSubsystemSender`
|
||||
|
|
||||
= note: this error originates in the attribute macro `orchestra` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0119]: conflicting implementations of trait `std::convert::From<MsgStrukt>` for type `AllMessages`
|
||||
--> tests/ui/err-01-duplicate-consumer.rs:19:1
|
||||
|
|
||||
19 | #[orchestra(signal=SigSigSig, event=Event, gen=AllMessages, error=OrchestraError)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
| |
|
||||
| first implementation here
|
||||
| conflicting implementation for `AllMessages`
|
||||
|
|
||||
= note: this error originates in the attribute macro `orchestra` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
@@ -0,0 +1,32 @@
|
||||
#![allow(dead_code)]
|
||||
|
||||
use orchestra::*;
|
||||
|
||||
#[derive(Default)]
|
||||
struct AwesomeSubSys;
|
||||
|
||||
struct SigSigSig;
|
||||
|
||||
struct Event;
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
struct MsgStrukt(u8);
|
||||
|
||||
#[orchestra(signal=SigSigSig, event=Event, gen=AllMessages, error=OrchestraError)]
|
||||
enum Orchestra {
|
||||
#[subsystem(MsgStrukt)]
|
||||
Sub0(AwesomeSubSys),
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
struct DummySpawner;
|
||||
|
||||
struct DummyCtx;
|
||||
|
||||
fn main() {
|
||||
let orchestra = Orchestra::<_,_>::builder()
|
||||
.sub0(AwesomeSubSys::default())
|
||||
.i_like_pie(std::f64::consts::PI)
|
||||
.spawner(DummySpawner)
|
||||
.build(|| -> DummyCtx { DummyCtx } );
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
error: expected `struct`
|
||||
--> $DIR/err-02-enum.rs:16:1
|
||||
|
|
||||
16 | enum Orchestra {
|
||||
| ^^^^
|
||||
|
||||
error[E0433]: failed to resolve: use of undeclared type `Orchestra`
|
||||
--> $DIR/err-02-enum.rs:27:17
|
||||
|
|
||||
27 | let orchestra = Orchestra::<_,_>::builder()
|
||||
| ^^^^^^^^ use of undeclared type `Orchestra`
|
||||
@@ -0,0 +1,39 @@
|
||||
#![allow(dead_code)]
|
||||
|
||||
use orchestra::*;
|
||||
|
||||
#[derive(Default)]
|
||||
struct AwesomeSubSys;
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
struct SigSigSig;
|
||||
|
||||
struct Event;
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
struct MsgStrukt(u8);
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
struct MsgStrukt2(f64);
|
||||
|
||||
#[orchestra(signal=SigSigSig, event=Event, gen=AllMessages, error=OrchestraError)]
|
||||
struct Orchestra {
|
||||
#[subsystem(MsgStrukt)]
|
||||
sub0: AwesomeSubSys,
|
||||
|
||||
#[subsystem(MsgStrukt2)]
|
||||
sub1: AwesomeSubSys,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
struct DummySpawner;
|
||||
|
||||
struct DummyCtx;
|
||||
|
||||
fn main() {
|
||||
let orchestra = Orchestra::<_,_>::builder()
|
||||
.sub0(AwesomeSubSys::default())
|
||||
.i_like_pie(std::f64::consts::PI)
|
||||
.spawner(DummySpawner)
|
||||
.build(|| -> DummyCtx { DummyCtx } );
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
error: Duplicate subsystem names `AwesomeSubSys`
|
||||
--> $DIR/err-03-subsys-twice.rs:25:8
|
||||
|
|
||||
25 | sub1: AwesomeSubSys,
|
||||
| ^^^^^^^^^^^^^
|
||||
|
||||
error: previously defined here.
|
||||
--> $DIR/err-03-subsys-twice.rs:22:8
|
||||
|
|
||||
22 | sub0: AwesomeSubSys,
|
||||
| ^^^^^^^^^^^^^
|
||||
|
||||
error[E0433]: failed to resolve: use of undeclared type `Orchestra`
|
||||
--> $DIR/err-03-subsys-twice.rs:34:17
|
||||
|
|
||||
34 | let orchestra = Orchestra::<_,_>::builder()
|
||||
| ^^^^^^^^ use of undeclared type `Orchestra`
|
||||
@@ -0,0 +1,36 @@
|
||||
#![allow(dead_code)]
|
||||
|
||||
use orchestra::*;
|
||||
|
||||
#[derive(Default)]
|
||||
struct AwesomeSubSys;
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
struct SigSigSig;
|
||||
|
||||
struct Event;
|
||||
|
||||
#[derive(Clone)]
|
||||
struct MsgStrukt(u8);
|
||||
|
||||
#[orchestra(signal=SigSigSig, event=Event, gen=AllMessages)]
|
||||
struct Orchestra {
|
||||
#[subsystem(MsgStrukt)]
|
||||
sub0: AwesomeSubSys,
|
||||
|
||||
i_like_pie: f64,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
struct DummySpawner;
|
||||
|
||||
struct DummyCtx;
|
||||
|
||||
fn main() {
|
||||
let _ = Orchestra::builder()
|
||||
.sub0(AwesomeSubSys::default())
|
||||
.i_like_pie(std::f64::consts::PI)
|
||||
.spawner(DummySpawner)
|
||||
.build()
|
||||
.unwrap();
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
error: Must declare the orchestra error type via `error=..`.
|
||||
--> $DIR/err-04-missing-error.rs:16:1
|
||||
|
|
||||
16 | #[orchestra(signal=SigSigSig, event=Event, gen=AllMessages)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: this error originates in the attribute macro `orchestra` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0433]: failed to resolve: use of undeclared type `Orchestra`
|
||||
--> $DIR/err-04-missing-error.rs:30:10
|
||||
|
|
||||
30 | let _ = Orchestra::builder()
|
||||
| ^^^^^^^^ use of undeclared type `Orchestra`
|
||||
@@ -0,0 +1,61 @@
|
||||
#![allow(dead_code)]
|
||||
|
||||
use orchestra::*;
|
||||
|
||||
#[derive(Default)]
|
||||
struct AwesomeSubSys;
|
||||
|
||||
impl ::orchestra::Subsystem<OrchestraSubsystemContext<MsgStrukt>, OrchestraError> for AwesomeSubSys {
|
||||
fn start(self, _ctx: OrchestraSubsystemContext<MsgStrukt>) -> SpawnedSubsystem<OrchestraError> {
|
||||
unimplemented!("starting yay!")
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct SigSigSig;
|
||||
|
||||
pub struct Event;
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct MsgStrukt(u8);
|
||||
|
||||
#[orchestra(signal=SigSigSig, error=OrchestraError, event=Event, gen=AllMessages)]
|
||||
struct Orchestra {
|
||||
#[subsystem(MsgStrukt)]
|
||||
sub0: AwesomeSubSys,
|
||||
i_like_pie: f64,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct DummySpawner;
|
||||
|
||||
impl Spawner for DummySpawner {
|
||||
fn spawn_blocking(
|
||||
&self,
|
||||
task_name: &'static str,
|
||||
subsystem_name: Option<&'static str>,
|
||||
_future: futures::future::BoxFuture<'static, ()>,
|
||||
) {
|
||||
unimplemented!("spawn blocking {} {}", task_name, subsystem_name.unwrap_or("default"))
|
||||
}
|
||||
|
||||
fn spawn(
|
||||
&self,
|
||||
task_name: &'static str,
|
||||
subsystem_name: Option<&'static str>,
|
||||
_future: futures::future::BoxFuture<'static, ()>,
|
||||
) {
|
||||
unimplemented!("spawn {} {}", task_name, subsystem_name.unwrap_or("default"))
|
||||
}
|
||||
}
|
||||
|
||||
struct DummyCtx;
|
||||
|
||||
fn main() {
|
||||
let _ = Orchestra::builder()
|
||||
.sub0(AwesomeSubSys::default())
|
||||
//.i_like_pie(std::f64::consts::PI) // The filed is not initialised
|
||||
.spawner(DummySpawner)
|
||||
.build()
|
||||
.unwrap();
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
error[E0599]: no method named `build` found for struct `OrchestraBuilder<Init<DummySpawner>, Init<AwesomeSubSys>, Missing<f64>>` in the current scope
|
||||
--> tests/ui/err-05-missing-field.rs:59:4
|
||||
|
|
||||
22 | #[orchestra(signal=SigSigSig, error=OrchestraError, event=Event, gen=AllMessages)]
|
||||
| -------------------------------------------------------------------------------- method `build` not found for this
|
||||
...
|
||||
59 | .build()
|
||||
| ^^^^^ method not found in `OrchestraBuilder<Init<DummySpawner>, Init<AwesomeSubSys>, Missing<f64>>`
|
||||
|
|
||||
= note: the method was found for
|
||||
- `OrchestraBuilder<Init<S>, Init<AwesomeSubSys>, Init<f64>>`
|
||||
= help: items from traits can only be used if the trait is implemented and in scope
|
||||
= note: the following traits define an item `build`, perhaps you need to implement one of them:
|
||||
candidate #1: `frame_support::traits::hooks::GenesisBuild`
|
||||
candidate #2: `prometheus::vec::MetricVecBuilder`
|
||||
@@ -0,0 +1,61 @@
|
||||
#![allow(dead_code)]
|
||||
|
||||
use orchestra::*;
|
||||
|
||||
#[derive(Default)]
|
||||
struct AwesomeSubSys;
|
||||
|
||||
impl ::orchestra::Subsystem<OrchestraSubsystemContext<MsgStrukt>, OrchestraError> for AwesomeSubSys {
|
||||
fn start(self, _ctx: OrchestraSubsystemContext<MsgStrukt>) -> SpawnedSubsystem<OrchestraError> {
|
||||
unimplemented!("starting yay!")
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct SigSigSig;
|
||||
|
||||
pub struct Event;
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct MsgStrukt(u8);
|
||||
|
||||
#[orchestra(signal=SigSigSig, error=OrchestraError, event=Event, gen=AllMessages)]
|
||||
struct Orchestra {
|
||||
#[subsystem(MsgStrukt)]
|
||||
sub0: AwesomeSubSys,
|
||||
i_like_pie: f64,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct DummySpawner;
|
||||
|
||||
impl Spawner for DummySpawner {
|
||||
fn spawn_blocking(
|
||||
&self,
|
||||
task_name: &'static str,
|
||||
subsystem_name: Option<&'static str>,
|
||||
_future: futures::future::BoxFuture<'static, ()>,
|
||||
) {
|
||||
unimplemented!("spawn blocking {} {}", task_name, subsystem_name.unwrap_or("default"))
|
||||
}
|
||||
|
||||
fn spawn(
|
||||
&self,
|
||||
task_name: &'static str,
|
||||
subsystem_name: Option<&'static str>,
|
||||
_future: futures::future::BoxFuture<'static, ()>,
|
||||
) {
|
||||
unimplemented!("spawn {} {}", task_name, subsystem_name.unwrap_or("default"))
|
||||
}
|
||||
}
|
||||
|
||||
struct DummyCtx;
|
||||
|
||||
fn main() {
|
||||
let _ = Orchestra::builder()
|
||||
//.sub0(AwesomeSubSys::default()) // Subsystem is uninitialized
|
||||
.i_like_pie(std::f64::consts::PI)
|
||||
.spawner(DummySpawner)
|
||||
.build()
|
||||
.unwrap();
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
error[E0599]: no method named `build` found for struct `OrchestraBuilder<Init<DummySpawner>, Missing<_>, Init<f64>>` in the current scope
|
||||
--> tests/ui/err-06-missing-subsystem.rs:59:4
|
||||
|
|
||||
22 | #[orchestra(signal=SigSigSig, error=OrchestraError, event=Event, gen=AllMessages)]
|
||||
| -------------------------------------------------------------------------------- method `build` not found for this
|
||||
...
|
||||
59 | .build()
|
||||
| ^^^^^ method not found in `OrchestraBuilder<Init<DummySpawner>, Missing<_>, Init<f64>>`
|
||||
|
|
||||
= note: the method was found for
|
||||
- `OrchestraBuilder<Init<S>, Init<AwesomeSubSys>, Init<f64>>`
|
||||
= help: items from traits can only be used if the trait is implemented and in scope
|
||||
= note: the following traits define an item `build`, perhaps you need to implement one of them:
|
||||
candidate #1: `frame_support::traits::hooks::GenesisBuild`
|
||||
candidate #2: `prometheus::vec::MetricVecBuilder`
|
||||
@@ -0,0 +1,61 @@
|
||||
#![allow(dead_code)]
|
||||
|
||||
use orchestra::*;
|
||||
|
||||
#[derive(Default)]
|
||||
struct AwesomeSubSys;
|
||||
|
||||
impl ::orchestra::Subsystem<OrchestraSubsystemContext<MsgStrukt>, OrchestraError> for AwesomeSubSys {
|
||||
fn start(self, _ctx: OrchestraSubsystemContext<MsgStrukt>) -> SpawnedSubsystem<OrchestraError> {
|
||||
unimplemented!("starting yay!")
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct SigSigSig;
|
||||
|
||||
pub struct Event;
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct MsgStrukt(u8);
|
||||
|
||||
#[orchestra(signal=SigSigSig, error=OrchestraError, event=Event, gen=AllMessages)]
|
||||
struct Orchestra {
|
||||
#[subsystem(MsgStrukt)]
|
||||
sub0: AwesomeSubSys,
|
||||
i_like_pie: f64,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct DummySpawner;
|
||||
|
||||
impl Spawner for DummySpawner {
|
||||
fn spawn_blocking(
|
||||
&self,
|
||||
task_name: &'static str,
|
||||
subsystem_name: Option<&'static str>,
|
||||
_future: futures::future::BoxFuture<'static, ()>,
|
||||
) {
|
||||
unimplemented!("spawn blocking {} {}", task_name, subsystem_name.unwrap_or("default"))
|
||||
}
|
||||
|
||||
fn spawn(
|
||||
&self,
|
||||
task_name: &'static str,
|
||||
subsystem_name: Option<&'static str>,
|
||||
_future: futures::future::BoxFuture<'static, ()>,
|
||||
) {
|
||||
unimplemented!("spawn {} {}", task_name, subsystem_name.unwrap_or("default"))
|
||||
}
|
||||
}
|
||||
|
||||
struct DummyCtx;
|
||||
|
||||
fn main() {
|
||||
let _ = Orchestra::builder()
|
||||
.sub0(AwesomeSubSys::default())
|
||||
.i_like_pie(std::f64::consts::PI)
|
||||
//.spawner(DummySpawner) // Spawner is missing
|
||||
.build()
|
||||
.unwrap();
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
error[E0599]: no method named `build` found for struct `OrchestraBuilder<Missing<_>, Init<AwesomeSubSys>, Init<f64>>` in the current scope
|
||||
--> tests/ui/err-07-missing-spawner.rs:59:4
|
||||
|
|
||||
22 | #[orchestra(signal=SigSigSig, error=OrchestraError, event=Event, gen=AllMessages)]
|
||||
| -------------------------------------------------------------------------------- method `build` not found for this
|
||||
...
|
||||
59 | .build()
|
||||
| ^^^^^ method not found in `OrchestraBuilder<Missing<_>, Init<AwesomeSubSys>, Init<f64>>`
|
||||
|
|
||||
= note: the method was found for
|
||||
- `OrchestraBuilder<Init<S>, Init<AwesomeSubSys>, Init<f64>>`
|
||||
= help: items from traits can only be used if the trait is implemented and in scope
|
||||
= note: the following traits define an item `build`, perhaps you need to implement one of them:
|
||||
candidate #1: `frame_support::traits::hooks::GenesisBuild`
|
||||
candidate #2: `prometheus::vec::MetricVecBuilder`
|
||||
@@ -0,0 +1,62 @@
|
||||
#![allow(dead_code)]
|
||||
|
||||
use orchestra::*;
|
||||
|
||||
#[derive(Default)]
|
||||
struct AwesomeSubSys;
|
||||
|
||||
impl ::orchestra::Subsystem<OrchestraSubsystemContext<MsgStrukt>, OrchestraError> for AwesomeSubSys {
|
||||
fn start(self, _ctx: OrchestraSubsystemContext<MsgStrukt>) -> SpawnedSubsystem<OrchestraError> {
|
||||
unimplemented!("starting yay!")
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct SigSigSig;
|
||||
|
||||
pub struct Event;
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct MsgStrukt(u8);
|
||||
|
||||
#[orchestra(signal=SigSigSig, error=OrchestraError, event=Event, gen=AllMessages)]
|
||||
struct Orchestra {
|
||||
#[subsystem(MsgStrukt)]
|
||||
sub0: AwesomeSubSys,
|
||||
i_like_pie: f64,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct DummySpawner;
|
||||
|
||||
impl Spawner for DummySpawner {
|
||||
fn spawn_blocking(
|
||||
&self,
|
||||
task_name: &'static str,
|
||||
subsystem_name: Option<&'static str>,
|
||||
_future: futures::future::BoxFuture<'static, ()>,
|
||||
) {
|
||||
unimplemented!("spawn blocking {} {}", task_name, subsystem_name.unwrap_or("default"))
|
||||
}
|
||||
|
||||
fn spawn(
|
||||
&self,
|
||||
task_name: &'static str,
|
||||
subsystem_name: Option<&'static str>,
|
||||
_future: futures::future::BoxFuture<'static, ()>,
|
||||
) {
|
||||
unimplemented!("spawn {} {}", task_name, subsystem_name.unwrap_or("default"))
|
||||
}
|
||||
}
|
||||
|
||||
struct DummyCtx;
|
||||
|
||||
fn main() {
|
||||
let _ = Orchestra::builder()
|
||||
.sub0(AwesomeSubSys::default())
|
||||
.sub0(AwesomeSubSys::default()) // Duplicate subsystem
|
||||
.i_like_pie(std::f64::consts::PI)
|
||||
.spawner(DummySpawner)
|
||||
.build()
|
||||
.unwrap();
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
error[E0599]: no method named `sub0` found for struct `OrchestraBuilder<Missing<_>, Init<AwesomeSubSys>, Missing<f64>>` in the current scope
|
||||
--> tests/ui/err-08-duplicate-subsystem.rs:57:4
|
||||
|
|
||||
22 | #[orchestra(signal=SigSigSig, error=OrchestraError, event=Event, gen=AllMessages)]
|
||||
| -------------------------------------------------------------------------------- method `sub0` not found for this
|
||||
...
|
||||
57 | .sub0(AwesomeSubSys::default()) // Duplicate subsystem
|
||||
| ^^^^-------------------------- help: remove the arguments
|
||||
| |
|
||||
| field, not a method
|
||||
@@ -0,0 +1,61 @@
|
||||
#![allow(dead_code)]
|
||||
|
||||
use orchestra::*;
|
||||
|
||||
#[derive(Default)]
|
||||
struct AwesomeSubSys;
|
||||
|
||||
impl ::orchestra::Subsystem<OrchestraSubsystemContext<MsgStrukt>, OrchestraError> for AwesomeSubSys {
|
||||
fn start(self, _ctx: OrchestraSubsystemContext<MsgStrukt>) -> SpawnedSubsystem<OrchestraError> {
|
||||
unimplemented!("starting yay!")
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct SigSigSig;
|
||||
|
||||
pub struct Event;
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct MsgStrukt(u8);
|
||||
|
||||
#[orchestra(signal=SigSigSig, error=OrchestraError, event=Event, gen=AllMessages)]
|
||||
struct Orchestra<T> {
|
||||
#[subsystem(MsgStrukt)]
|
||||
sub0: AwesomeSubSys,
|
||||
i_like_pie: T,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct DummySpawner;
|
||||
|
||||
impl Spawner for DummySpawner {
|
||||
fn spawn_blocking(
|
||||
&self,
|
||||
task_name: &'static str,
|
||||
subsystem_name: Option<&'static str>,
|
||||
_future: futures::future::BoxFuture<'static, ()>,
|
||||
) {
|
||||
unimplemented!("spawn blocking {} {}", task_name, subsystem_name.unwrap_or("default"))
|
||||
}
|
||||
|
||||
fn spawn(
|
||||
&self,
|
||||
task_name: &'static str,
|
||||
subsystem_name: Option<&'static str>,
|
||||
_future: futures::future::BoxFuture<'static, ()>,
|
||||
) {
|
||||
unimplemented!("spawn {} {}", task_name, subsystem_name.unwrap_or("default"))
|
||||
}
|
||||
}
|
||||
|
||||
struct DummyCtx;
|
||||
|
||||
fn main() {
|
||||
let (_, _): (Orchestra<_, f64>, _) = Orchestra::builder()
|
||||
.sub0(AwesomeSubSys::default())
|
||||
//.i_like_pie(std::f64::consts::PI) // The filed is not initialised
|
||||
.spawner(DummySpawner)
|
||||
.build()
|
||||
.unwrap();
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
error[E0599]: no method named `build` found for struct `OrchestraBuilder<Init<DummySpawner>, Init<AwesomeSubSys>, Missing<_>>` in the current scope
|
||||
--> tests/ui/err-09-uninit_generic_baggage.rs:59:4
|
||||
|
|
||||
22 | #[orchestra(signal=SigSigSig, error=OrchestraError, event=Event, gen=AllMessages)]
|
||||
| -------------------------------------------------------------------------------- method `build` not found for this
|
||||
...
|
||||
59 | .build()
|
||||
| ^^^^^ method not found in `OrchestraBuilder<Init<DummySpawner>, Init<AwesomeSubSys>, Missing<_>>`
|
||||
|
|
||||
= note: the method was found for
|
||||
- `OrchestraBuilder<Init<S>, Init<AwesomeSubSys>, Init<T>>`
|
||||
= help: items from traits can only be used if the trait is implemented and in scope
|
||||
= note: the following traits define an item `build`, perhaps you need to implement one of them:
|
||||
candidate #1: `frame_support::traits::hooks::GenesisBuild`
|
||||
candidate #2: `prometheus::vec::MetricVecBuilder`
|
||||
@@ -0,0 +1,75 @@
|
||||
#![allow(dead_code)]
|
||||
|
||||
use orchestra::*;
|
||||
|
||||
#[derive(Default)]
|
||||
struct AwesomeSubSysA;
|
||||
|
||||
|
||||
impl ::orchestra::Subsystem<OrchestraSubsystemContext<MsgA>, OrchestraError> for AwesomeSubSysA {
|
||||
fn start(self, _ctx: OrchestraSubsystemContext<MsgA>) -> SpawnedSubsystem<OrchestraError> {
|
||||
SpawnedSubsystem { name: "sub A", future: Box::pin(async move { Ok(()) }) }
|
||||
}
|
||||
}
|
||||
impl ::orchestra::Subsystem<OrchestraSubsystemContext<MsgB>, OrchestraError> for AwesomeSubSysB {
|
||||
fn start(self, _ctx: OrchestraSubsystemContext<MsgB>) -> SpawnedSubsystem<OrchestraError> {
|
||||
SpawnedSubsystem { name: "sub B", future: Box::pin(async move { Ok(()) }) }
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct DummySpawner;
|
||||
|
||||
impl Spawner for DummySpawner {
|
||||
fn spawn_blocking(
|
||||
&self,
|
||||
task_name: &'static str,
|
||||
subsystem_name: Option<&'static str>,
|
||||
_future: futures::future::BoxFuture<'static, ()>,
|
||||
) {
|
||||
println!("spawn blocking {} {}", task_name, subsystem_name.unwrap_or("default"))
|
||||
}
|
||||
|
||||
fn spawn(
|
||||
&self,
|
||||
task_name: &'static str,
|
||||
subsystem_name: Option<&'static str>,
|
||||
_future: futures::future::BoxFuture<'static, ()>,
|
||||
) {
|
||||
println!("spawn {} {}", task_name, subsystem_name.unwrap_or("default"))
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
struct AwesomeSubSysB;
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct SigSigSig;
|
||||
|
||||
pub struct Event;
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct MsgA(u8);
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct MsgB(u8);
|
||||
|
||||
#[orchestra(signal=SigSigSig, event=Event, gen=AllMessages, error=OrchestraError)]
|
||||
pub struct Orchestra {
|
||||
#[subsystem(MsgA)]
|
||||
sub_a: AwesomeSubSysA,
|
||||
|
||||
#[subsystem(wip, MsgB)]
|
||||
sub_b: AwesomeSubSysB,
|
||||
}
|
||||
|
||||
pub struct DummyCtx;
|
||||
|
||||
fn main() {
|
||||
let _orchestra_builder = Orchestra::builder()
|
||||
.sub_a(AwesomeSubSysA::default())
|
||||
// b is tagged as `wip`
|
||||
// .sub_b(AwesomeSubSysB::default())
|
||||
.spawner(DummySpawner)
|
||||
.build();
|
||||
}
|
||||
Reference in New Issue
Block a user