mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-27 16:17:59 +00:00
31327eb0c7
* test: add unit test to catch missing distribution to subsystems faster * add a simple count * introduce proc macro to generate dispatch type * refactor * refactor * chore: add license * fixup unit test * fixup merge * better errors * better fmt * fix error spans * better docs * better error messages * ui test foo * Update node/subsystem/dispatch-gen/src/lib.rs Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> * Update node/network/bridge/src/lib.rs Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> * Update node/subsystem/Cargo.toml Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> * Update node/subsystem/dispatch-gen/src/lib.rs Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> * Update node/subsystem/dispatch-gen/src/lib.rs Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> * Update node/network/bridge/src/lib.rs Co-authored-by: Andronik Ordian <write@reusable.software> * fix compilation * use find_map * drop the silly 2, use _inner instead * Update node/network/bridge/src/lib.rs Co-authored-by: Andronik Ordian <write@reusable.software> * Update node/subsystem/dispatch-gen/src/lib.rs Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> * nail deps down * more into() * flatten * missing use statement * fix messages order Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> Co-authored-by: Andronik Ordian <write@reusable.software>
42 lines
663 B
Rust
42 lines
663 B
Rust
#![allow(dead_code)]
|
|
|
|
use polkadot_procmacro_subsystem_dispatch_gen::subsystem_dispatch_gen;
|
|
|
|
/// The event type in question.
|
|
#[derive(Clone, Copy, Debug)]
|
|
enum Event {
|
|
Smth,
|
|
Else,
|
|
}
|
|
|
|
impl Event {
|
|
fn focus(&self) -> std::result::Result<Intermediate, ()> {
|
|
Ok(Intermediate(self.clone()))
|
|
}
|
|
}
|
|
|
|
#[derive(Debug, Clone)]
|
|
struct Intermediate(Event);
|
|
|
|
|
|
/// This should have a `From<Event>` impl but does not.
|
|
#[derive(Debug, Clone)]
|
|
enum Inner {
|
|
Foo,
|
|
Bar(Intermediate),
|
|
}
|
|
|
|
#[subsystem_dispatch_gen(Event)]
|
|
#[derive(Clone)]
|
|
enum AllMessages {
|
|
/// Foo
|
|
Vvvvvv(Inner),
|
|
|
|
#[skip]
|
|
Uuuuu,
|
|
}
|
|
|
|
fn main() {
|
|
let _x = AllMessages::dispatch_iter(Event::Else);
|
|
}
|