use crate::Buffer;
#[derive(Clone, Copy)]
pub(crate) struct Backend {
refill_impl: unsafe fn(&[u32; 8], &mut Buffer),
}
impl Backend {
pub(crate) fn new(refill_impl: fn(&[u32; 8], &mut Buffer)) -> Self {
Backend { refill_impl }
}
#[allow(
dead_code,
reason = "only used on targets with runtime feature detection"
)]
pub(crate) unsafe fn new_unchecked(refill_impl: unsafe fn(&[u32; 8], &mut Buffer)) -> Self {
Self { refill_impl }
}
#[inline]
pub(crate) fn refill(self, key: &[u32; 8], buf: &mut Buffer) {
unsafe { (self.refill_impl)(key, buf) }
}
}