use dope_sys::{io::Close, memory};
pub(crate) use payload::Payload;
use crate::reactor::buffers::{self, Cleanup, Pending};
mod payload;
#[derive(Debug)]
pub struct Canary<L: memory::raw::Canary> {
pub(in crate::reactor) producer: buffers::raw::Producer<L>,
pub(super) context: buffers::raw::Context<L>,
}
impl<L: memory::raw::Canary> Close for Canary<L> {
type State = Cleanup;
fn try_close(self) -> Result<(), Cleanup> {
self.into_mappings().try_close()
}
}
impl<L: memory::raw::Canary> Canary<L> {
pub(in crate::reactor) fn into_mappings(self) -> Pending {
Pending {
current: self.producer.into_region(),
context: Some(self.context.into_region()),
}
}
}