#[non_exhaustive]pub enum DispatchAction {
Handled,
Reply(Vec<u8>),
ForwardToAiDaemon(RequestId),
}Expand description
Outcome returned to the connection loop after dispatching a frame.
Marked #[non_exhaustive] because new variants will be added as the AI
daemon layer is built out. Downstream code must include a wildcard arm
when matching on this type.
§Examples
use nerve_ipc_core::DispatchAction;
fn handle(action: DispatchAction) -> Option<Vec<u8>> {
match action {
DispatchAction::Handled => None,
DispatchAction::Reply(bytes) => Some(bytes),
DispatchAction::ForwardToAiDaemon(_) => None,
// Required: new variants will be added as the AI daemon is built out.
_ => None,
}
}Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Handled
Frame was handled; no response needs to be sent to the client.
Reply(Vec<u8>)
Frame generated a response that the transport must write back to the client. The bytes are a complete, encoded NERVE frame.
ForwardToAiDaemon(RequestId)
A MessageType::SearchQuery was received. The request has been
registered in the RequestTable so that a subsequent
MessageType::Cancel can mark it cancelled. The AI daemon (a future
milestone) is responsible for consuming and responding to this request.
The enclosed RequestId is the ID already stored in the request table.
Auto Trait Implementations§
impl Freeze for DispatchAction
impl RefUnwindSafe for DispatchAction
impl Send for DispatchAction
impl Sync for DispatchAction
impl Unpin for DispatchAction
impl UnsafeUnpin for DispatchAction
impl UnwindSafe for DispatchAction
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more