mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-09 12:49:23 +00:00
Simply Coordinator/Processors::send by accepting impl Into *Message
This commit is contained in:
@@ -10,14 +10,15 @@ pub struct Message {
|
||||
|
||||
#[async_trait::async_trait]
|
||||
pub trait Coordinator {
|
||||
async fn send(&mut self, msg: ProcessorMessage);
|
||||
async fn send(&mut self, msg: impl Send + Into<ProcessorMessage>);
|
||||
async fn recv(&mut self) -> Message;
|
||||
async fn ack(&mut self, msg: Message);
|
||||
}
|
||||
|
||||
#[async_trait::async_trait]
|
||||
impl Coordinator for MessageQueue {
|
||||
async fn send(&mut self, msg: ProcessorMessage) {
|
||||
async fn send(&mut self, msg: impl Send + Into<ProcessorMessage>) {
|
||||
let msg: ProcessorMessage = msg.into();
|
||||
let metadata = Metadata { from: self.service, to: Service::Coordinator, intent: msg.intent() };
|
||||
let msg = serde_json::to_string(&msg).unwrap();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user