Open
Description
Should I always wrap my FDs in a generic wrapper even if I implement EventSource and just have a single source?
pub struct IPCSource {
socket_source: calloop::generic::Generic<calloop::generic::FdWrapper<UnixListener>>,
}
impl calloop::EventSource for IPCSource {
...
}
vs
pub struct IPCSource {
socket: UnixListener,
}
impl calloop::EventSource for IPCSource {
...
}
And if I do wrap it in a Generic:
How should I process events
fn process_events<F>(
&mut self,
readiness: calloop::Readiness,
token: calloop::Token,
callback: F,
) -> Result<calloop::PostAction, Self::Error>
where
F: FnMut(Self::Event, &mut Self::Metadata) -> Self::Ret,
{
self.socket_source
.process_events(readiness, token, |evt, _| {
if readiness.readable {
// TODO
}
});
Ok(calloop::PostAction::Continue)
}
vs
fn process_events<F>(
&mut self,
readiness: calloop::Readiness,
token: calloop::Token,
callback: F,
) -> Result<calloop::PostAction, Self::Error>
where
F: FnMut(Self::Event, &mut Self::Metadata) -> Self::Ret,
{
if readiness.readable {
// TODO
}
Ok(calloop::PostAction::Continue)
}
Metadata
Metadata
Assignees
Labels
No labels