Skip to main content

HostBytesBackend

Struct HostBytesBackend 

Source
pub struct HostBytesBackend;
Expand description

Minimal host-resident backend used as the default backend adapter for host-visible byte-slice views in generic helper code.

Trait Implementations§

Source§

impl Backend for HostBytesBackend

Source§

type ScalarBig = i128

Scalar type for extended-precision (big) polynomial representations.
Source§

type ScalarPrep = i64

Scalar type for DFT-domain (prepared) polynomial representations.
Source§

type OwnedBuf = Vec<u8>

Owned backend storage for layouts and scratch. Read more
Source§

type BufRef<'a> = &'a [u8]

Shared borrowed view into backend-owned storage.
Source§

type BufMut<'a> = &'a mut [u8]

Mutable borrowed view into backend-owned storage.
Source§

type Handle = ()

Opaque backend handle type (e.g. precomputed FFT twiddle factors).
Source§

type Location = Host

Residency of this backend’s buffers — Host or Device.
Source§

fn alloc_bytes(len: usize) -> <HostBytesBackend as Backend>::OwnedBuf

Allocates a backend-owned byte buffer of len bytes.
Source§

fn alloc_zeroed_bytes(len: usize) -> <HostBytesBackend as Backend>::OwnedBuf

Allocates a zero-initialized backend-owned byte buffer of len bytes. Read more
Source§

fn from_host_bytes(bytes: &[u8]) -> <HostBytesBackend as Backend>::OwnedBuf

Uploads or copies host bytes into backend-owned storage.
Source§

fn from_bytes(bytes: Vec<u8>) -> <HostBytesBackend as Backend>::OwnedBuf

Wraps/Uploads a host-owned byte buffer into backend-owned storage. Read more
Source§

fn to_host_bytes(buf: &<HostBytesBackend as Backend>::OwnedBuf) -> Vec<u8>

Copies the contents of a backend-owned buffer into a fresh host Vec<u8>. Read more
Source§

fn copy_to_host(buf: &<HostBytesBackend as Backend>::OwnedBuf, dst: &mut [u8])

Copies the contents of a backend-owned buffer into a host byte slice. Read more
Source§

fn copy_from_host(buf: &mut <HostBytesBackend as Backend>::OwnedBuf, src: &[u8])

Copies a host byte slice into a backend-owned buffer. Read more
Source§

fn len_bytes(buf: &<HostBytesBackend as Backend>::OwnedBuf) -> usize

Returns the number of bytes stored in a backend-owned buffer.
Source§

fn view( buf: &<HostBytesBackend as Backend>::OwnedBuf, ) -> <HostBytesBackend as Backend>::BufRef<'_>

Borrows a shared backend-native view over an owned buffer.
Source§

fn view_ref<'a, 'b>( buf: &'a <HostBytesBackend as Backend>::BufRef<'b>, ) -> <HostBytesBackend as Backend>::BufRef<'a>
where HostBytesBackend: 'b,

Reborrows an existing shared backend-native view.
Source§

fn view_ref_mut<'a, 'b>( buf: &'a <HostBytesBackend as Backend>::BufMut<'b>, ) -> <HostBytesBackend as Backend>::BufRef<'a>
where HostBytesBackend: 'b,

Reborrows a mutable backend-native view as a shared backend-native view.
Source§

fn view_mut_ref<'a, 'b>( buf: &'a mut <HostBytesBackend as Backend>::BufMut<'b>, ) -> <HostBytesBackend as Backend>::BufMut<'a>
where HostBytesBackend: 'b,

Reborrows an existing mutable backend-native view.
Source§

fn view_mut( buf: &mut <HostBytesBackend as Backend>::OwnedBuf, ) -> <HostBytesBackend as Backend>::BufMut<'_>

Borrows a mutable backend-native view over an owned buffer.
Source§

fn region( buf: &<HostBytesBackend as Backend>::OwnedBuf, offset: usize, len: usize, ) -> <HostBytesBackend as Backend>::BufRef<'_>

Borrows a shared sub-region of an owned buffer.
Source§

fn region_mut( buf: &mut <HostBytesBackend as Backend>::OwnedBuf, offset: usize, len: usize, ) -> <HostBytesBackend as Backend>::BufMut<'_>

Borrows a mutable sub-region of an owned buffer.
Source§

fn region_ref<'a, 'b>( buf: &'a <HostBytesBackend as Backend>::BufRef<'b>, offset: usize, len: usize, ) -> <HostBytesBackend as Backend>::BufRef<'a>
where HostBytesBackend: 'b,

Reborrows a shared sub-region of an existing shared backend-native view.
Source§

fn region_ref_mut<'a, 'b>( buf: &'a <HostBytesBackend as Backend>::BufMut<'b>, offset: usize, len: usize, ) -> <HostBytesBackend as Backend>::BufRef<'a>
where HostBytesBackend: 'b,

Reborrows a shared sub-region of an existing mutable backend-native view.
Source§

fn region_mut_ref<'a, 'b>( buf: &'a mut <HostBytesBackend as Backend>::BufMut<'b>, offset: usize, len: usize, ) -> <HostBytesBackend as Backend>::BufMut<'a>
where HostBytesBackend: 'b,

Reborrows a mutable sub-region of an existing mutable backend-native view.
Source§

unsafe fn destroy(_handle: NonNull<<HostBytesBackend as Backend>::Handle>)

Deallocates a backend handle. Read more
Source§

fn size_of_scalar_big() -> usize

Bytes size of ScalarBig.
Source§

fn size_of_scalar_prep() -> usize

Bytes size of ScalarPrep.
Source§

const SCRATCH_ALIGN: usize = 64

Required alignment (in bytes) for scratch-arena carved regions. Read more
Source§

fn bytes_of_vec_znx_dft(n: usize, cols: usize, size: usize) -> usize

Byte size of a crate::layouts::VecZnxDft buffer.
Source§

fn bytes_of_vec_znx_big(n: usize, cols: usize, size: usize) -> usize

Byte size of a crate::layouts::VecZnxBig buffer.
Source§

fn bytes_of_svp_ppol(n: usize, cols: usize) -> usize

Byte size of a crate::layouts::SvpPPol buffer.
Source§

fn bytes_of_vmp_pmat( n: usize, rows: usize, cols_in: usize, cols_out: usize, size: usize, ) -> usize

Byte size of a crate::layouts::VmpPMat buffer.
Source§

fn bytes_of_cnv_pvec_left(n: usize, cols: usize, size: usize) -> usize

Byte size of a crate::layouts::CnvPVecL buffer.
Source§

fn bytes_of_cnv_pvec_right(n: usize, cols: usize, size: usize) -> usize

Byte size of a crate::layouts::CnvPVecR buffer.
Source§

impl Clone for HostBytesBackend

Source§

fn clone(&self) -> HostBytesBackend

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for HostBytesBackend

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Default for HostBytesBackend

Source§

fn default() -> HostBytesBackend

Returns the “default value” for a type. Read more
Source§

impl HalModuleImpl<HostBytesBackend> for HostBytesBackend

Source§

impl PartialEq for HostBytesBackend

Source§

fn eq(&self, other: &HostBytesBackend) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for HostBytesBackend

Source§

impl Eq for HostBytesBackend

Source§

impl StructuralPartialEq for HostBytesBackend

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> TransferFrom<HostBytesBackend> for T
where T: Backend<Location = Host, OwnedBuf = Vec<u8>>,

Source§

fn transfer_buf(src: &Vec<u8>) -> <T as Backend>::OwnedBuf

Transfers a buffer owned by From into Self.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<BE> HostBackend for BE
where BE: Backend<Location = Host>,

Source§

impl<BE> HostVisibleBackend for BE
where BE: HostBackend, <BE as Backend>::BufRef<'a>: for<'a> AsRef<[u8]>, <BE as Backend>::BufMut<'a>: for<'a> AsRef<[u8]> + for<'a> AsMut<[u8]>,

Source§

impl<BE> TestBackend for BE
where BE: Backend,

Source§

impl<BE> TestContextBackend for BE
where BE: Backend<OwnedBuf = Vec<u8>> + HostBackend + TransferFrom<HostBytesBackend> + Send + Sync + 'static, ScratchOwned<BE>: ScratchOwnedAlloc<BE>,