Skip to main content

Prepared

Trait Prepared 

Source
pub trait Prepared: Sealed {
    // Provided method
    fn part(&self, messages: Range<usize>) -> Part<'_> { ... }
}
Expand description

The batch calls’ input: messages of one length, prepared so that a call reads them as they are. Batch holds them in blocks, any length; Packed, owned Vec<[u8; N]> / Box<[[u8; N]]> and borrowed &[[u8; N]] slices (N = 16, 32, or 48) hold fixed-width messages end to end. Sealed: the crate’s types and fixed-width byte-array collections/slices alone.

Provided Methods§

Source

fn part(&self, messages: Range<usize>) -> Part<'_>

The messages messages of this batch, as a batch: for a program that hashes a batch in parts (each part on a thread of its own).

Requires a range within the batch.

use blake3_servil_core::{Mode, throughput::{self, Batch, Prepared}};
let mut batch = Batch::new(100, 8);
for i in 0..8 {
    batch.set(i, &[i as u8; 100]);
}
let (mut whole, mut parts) = ([[0u8; 32]; 8], [[0u8; 32]; 8]);
throughput::hash_many(Mode::Plain, &batch, &mut whole);
throughput::hash_many(Mode::Plain, &batch.part(0..3), &mut parts[..3]);
throughput::hash_many(Mode::Plain, &batch.part(3..8), &mut parts[3..]);
assert_eq!(whole, parts);

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl Prepared for Box<[[u8; 16]]>

Source§

impl Prepared for Box<[[u8; 32]]>

Source§

impl Prepared for Box<[[u8; 48]]>

Source§

impl Prepared for Vec<[u8; 16]>

Source§

impl Prepared for Vec<[u8; 32]>

Source§

impl Prepared for Vec<[u8; 48]>

Source§

impl Prepared for [[u8; 16]]

Source§

impl Prepared for [[u8; 32]]

Source§

impl Prepared for [[u8; 48]]

Implementors§

Source§

impl Prepared for Batch<'_>

Source§

impl Prepared for Part<'_>

Source§

impl<const N: usize> Prepared for Packed<N>