mirror of
https://github.com/Noratrieb/haesli.git
synced 2026-01-17 05:05:03 +01:00
implement binding
This commit is contained in:
parent
6f6c0848ac
commit
a1fa68396f
9 changed files with 181 additions and 77 deletions
|
|
@ -419,12 +419,11 @@ impl TransportConnection {
|
|||
|
||||
// call into haesli_messaging to handle the method
|
||||
// it returns the response method that we are supposed to send
|
||||
// maybe this might become an `Option` in the future
|
||||
let return_method = (self.handlers.handle_method)(channel_handle, method)?;
|
||||
|
||||
//let return_method =
|
||||
// haesli_messaging::methods::handle_method(channel_handle, method).await?;
|
||||
self.send_method(frame.channel, &return_method).await?;
|
||||
if let Some(method) = return_method {
|
||||
self.send_method(frame.channel, &method).await?;
|
||||
}
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ use crate::connection::TransportConnection;
|
|||
|
||||
#[derive(Clone, Copy)]
|
||||
pub struct Handlers {
|
||||
pub handle_method: fn(Channel, Method) -> Result<Method, ProtocolError>,
|
||||
pub handle_method: fn(Channel, Method) -> Result<Option<Method>, ProtocolError>,
|
||||
pub handle_basic_publish: fn(Channel, Message) -> Result<(), ProtocolError>,
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue