poulpy-hal 0.6.0

A crate providing layouts and a trait-based hardware acceleration layer with open extension points, matching the API and types of spqlios-arithmetic.
Documentation
use crate::{
    api::{ScratchAvailable, ScratchOwnedAlloc, ScratchOwnedBorrow},
    layouts::{Backend, ScratchArena, ScratchOwned},
};

impl<B> ScratchOwnedAlloc<B> for ScratchOwned<B>
where
    B: Backend,
{
    fn alloc(size: usize) -> Self {
        ScratchOwned {
            data: B::alloc_bytes(size),
            _phantom: std::marker::PhantomData,
        }
    }
}

impl<B> ScratchOwnedBorrow<B> for ScratchOwned<B>
where
    B: Backend,
{
    fn borrow(&mut self) -> ScratchArena<'_, B> {
        self.arena()
    }
}

impl<B: Backend> ScratchAvailable for ScratchArena<'_, B> {
    fn available(&self) -> usize {
        ScratchArena::available(self)
    }
}