poulpy/poulpy-hal/src/oep/scratch.rs
poulpy-hal/src/oep/scratch.rsRaw
1use crate::layouts::{Backend, Scratch, ScratchOwned};
2
3/// # THIS TRAIT IS AN OPEN EXTENSION POINT (unsafe)
4/// * See the [poulpy-backend/src/cpu_fft64_ref/scratch.rs](https://github.com/phantomzone-org/poulpy/blob/main/poulpy-backend/src/cpu_fft64_ref/scratch.rs) reference implementation.
5/// * See [crate::api::ScratchOwnedAlloc] for corresponding public API.
6/// # Safety [crate::doc::backend_safety] for safety contract.
7pub unsafe trait ScratchOwnedAllocImpl<B: Backend> {
8 fn scratch_owned_alloc_impl(size: usize) -> ScratchOwned<B>;
9}
10
11/// # THIS TRAIT IS AN OPEN EXTENSION POINT (unsafe)
12/// * See the [poulpy-backend/src/cpu_fft64_ref/scratch.rs](https://github.com/phantomzone-org/poulpy/blob/main/poulpy-backend/src/cpu_fft64_ref/scratch.rs) reference implementation.
13/// * See [crate::api::ScratchOwnedBorrow] for corresponding public API.
14/// # Safety [crate::doc::backend_safety] for safety contract.
15pub unsafe trait ScratchOwnedBorrowImpl<B: Backend> {
16 fn scratch_owned_borrow_impl(scratch: &mut ScratchOwned<B>) -> &mut Scratch<B>;
17}
18
19/// # THIS TRAIT IS AN OPEN EXTENSION POINT (unsafe)
20/// * See the [poulpy-backend/src/cpu_fft64_ref/scratch.rs](https://github.com/phantomzone-org/poulpy/blob/main/poulpy-backend/src/cpu_fft64_ref/scratch.rs) reference implementation.
21/// * See [crate::api::ScratchFromBytes] for corresponding public API.
22/// # Safety [crate::doc::backend_safety] for safety contract.
23pub unsafe trait ScratchFromBytesImpl<B: Backend> {
24 fn scratch_from_bytes_impl(data: &mut [u8]) -> &mut Scratch<B>;
25}
26
27/// # THIS TRAIT IS AN OPEN EXTENSION POINT (unsafe)
28/// * See the [poulpy-backend/src/cpu_fft64_ref/scratch.rs](https://github.com/phantomzone-org/poulpy/blob/main/poulpy-backend/src/cpu_fft64_ref/scratch.rs) reference implementation.
29/// * See [crate::api::ScratchAvailable] for corresponding public API.
30/// # Safety [crate::doc::backend_safety] for safety contract.
31pub unsafe trait ScratchAvailableImpl<B: Backend> {
32 fn scratch_available_impl(scratch: &Scratch<B>) -> usize;
33}
34
35/// # THIS TRAIT IS AN OPEN EXTENSION POINT (unsafe)
36/// * See the [poulpy-backend/src/cpu_fft64_ref/scratch.rs](https://github.com/phantomzone-org/poulpy/blob/main/poulpy-backend/src/cpu_fft64_ref/scratch.rs) reference implementation.
37/// * See [crate::api::ScratchOwnedAlloc] for corresponding public API.
38/// # Safety [crate::doc::backend_safety] for safety contract.
39pub unsafe trait TakeSliceImpl<B: Backend> {
40 fn take_slice_impl<T>(scratch: &mut Scratch<B>, len: usize) -> (&mut [T], &mut Scratch<B>);
41}