pub struct SidecarBuilder<T = SimpleCoder> { /* private fields */ }
Expand description
Build a BlobTransactionSidecar
from an arbitrary amount of data.
This is useful for creating a sidecar from a large amount of data, which is then split into blobs. It delays KZG commitments and proofs until all data is ready.
Implementations§
Source§impl<T: SidecarCoder + Default> SidecarBuilder<T>
impl<T: SidecarCoder + Default> SidecarBuilder<T>
Sourcepub fn new() -> Self
pub fn new() -> Self
Instantiate a new builder and new coder instance.
By default, this allocates space for 2 blobs (256 KiB). If you want to
preallocate a specific number of blobs, use
SidecarBuilder::with_capacity
.
Sourcepub fn from_slice(data: &[u8]) -> Self
pub fn from_slice(data: &[u8]) -> Self
Create a new builder from a slice of data by calling
SidecarBuilder::from_coder_and_data
Sourcepub fn with_capacity(capacity: usize) -> Self
pub fn with_capacity(capacity: usize) -> Self
Create a new builder with a pre-allocated capacity. This capacity is measured in blobs, each of which is 128 KiB.
Source§impl<T: SidecarCoder> SidecarBuilder<T>
impl<T: SidecarCoder> SidecarBuilder<T>
Sourcepub fn from_coder_and_capacity(coder: T, capacity: usize) -> Self
pub fn from_coder_and_capacity(coder: T, capacity: usize) -> Self
Instantiate a new builder with the provided coder and capacity. This capacity is measured in blobs, each of which is 128 KiB.
Sourcepub const fn len(&self) -> usize
pub const fn len(&self) -> usize
Calculate the length of bytes used by field elements in the builder.
This is always strictly greater than the number of bytes that have been ingested.
Sourcepub fn from_coder_and_data(coder: T, data: &[u8]) -> Self
pub fn from_coder_and_data(coder: T, data: &[u8]) -> Self
Create a new builder from a slice of data.
Trait Implementations§
Source§impl<T: Clone> Clone for SidecarBuilder<T>
impl<T: Clone> Clone for SidecarBuilder<T>
Source§fn clone(&self) -> SidecarBuilder<T>
fn clone(&self) -> SidecarBuilder<T>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl<T: Debug> Debug for SidecarBuilder<T>
impl<T: Debug> Debug for SidecarBuilder<T>
Source§impl<T> Default for SidecarBuilder<T>where
T: Default + SidecarCoder,
impl<T> Default for SidecarBuilder<T>where
T: Default + SidecarCoder,
Source§impl<T: SidecarCoder> From<T> for SidecarBuilder<T>
impl<T: SidecarCoder> From<T> for SidecarBuilder<T>
Source§fn from(coder: T) -> Self
fn from(coder: T) -> Self
Instantiate a new builder with the provided coder.
This is equivalent to calling
SidecarBuilder::from_coder_and_capacity
with a capacity of 1.
If you want to preallocate a specific number of blobs, use
SidecarBuilder::from_coder_and_capacity
.