Skip to main content

dope_uring/reactor/sq/
source.rs

1use dope_sys::{
2    io::request::{Context, Source},
3    memory::buffer::provided,
4};
5
6use crate::{Uring, reactor::sq};
7
8impl<C: Context> Source<C> for Uring {
9    type Raw = sq::Entry;
10    const GROUP: u16 = <Self as provided::Source>::PROVIDED;
11
12    fn target(slot: C::Target) -> sq::Fixed {
13        sq::Fixed::new(sq::Index::from_le(slot.into()))
14    }
15
16    fn outbound(slot: C::Outbound) -> sq::Fixed {
17        sq::Fixed::new(sq::Index::from_le(slot.into()))
18    }
19
20    fn datagram<'d>(fd: &C::Datagram<'d>) -> sq::Fixed {
21        <Self as Source<C>>::target(C::datagram(fd))
22    }
23}