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> SidecarBuilder<T>where
T: SidecarCoder + Default,
impl<T> SidecarBuilder<T>where
T: SidecarCoder + Default,
Sourcepub fn new() -> SidecarBuilder<T>
pub fn new() -> SidecarBuilder<T>
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]) -> SidecarBuilder<T>
pub fn from_slice(data: &[u8]) -> SidecarBuilder<T>
Create a new builder from a slice of data by calling
SidecarBuilder::from_coder_and_data
Sourcepub fn with_capacity(capacity: usize) -> SidecarBuilder<T>
pub fn with_capacity(capacity: usize) -> SidecarBuilder<T>
Create a new builder with a pre-allocated capacity. This capacity is measured in blobs, each of which is 128 KiB.
Source§impl<T> SidecarBuilder<T>where
T: SidecarCoder,
impl<T> SidecarBuilder<T>where
T: SidecarCoder,
Sourcepub fn from_coder_and_capacity(coder: T, capacity: usize) -> SidecarBuilder<T>
pub fn from_coder_and_capacity(coder: T, capacity: usize) -> SidecarBuilder<T>
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]) -> SidecarBuilder<T>
pub fn from_coder_and_data(coder: T, data: &[u8]) -> SidecarBuilder<T>
Create a new builder from a slice of data.
Sourcepub fn take(self) -> Vec<FixedBytes<alloy_eips::::eip4844::Blob::{constant#0}>>
pub fn take(self) -> Vec<FixedBytes<alloy_eips::::eip4844::Blob::{constant#0}>>
Take the blobs from the builder, without committing them to a KZG proof.
Trait Implementations§
Source§impl<T> Clone for SidecarBuilder<T>where
T: Clone,
impl<T> Clone for SidecarBuilder<T>where
T: Clone,
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 for SidecarBuilder<T>where
T: Debug,
impl<T> Debug for SidecarBuilder<T>where
T: Debug,
Source§impl<T> Default for SidecarBuilder<T>where
T: Default + SidecarCoder,
impl<T> Default for SidecarBuilder<T>where
T: Default + SidecarCoder,
Source§fn default() -> SidecarBuilder<T>
fn default() -> SidecarBuilder<T>
Source§impl<T> From<T> for SidecarBuilder<T>where
T: SidecarCoder,
impl<T> From<T> for SidecarBuilder<T>where
T: SidecarCoder,
Source§fn from(coder: T) -> SidecarBuilder<T>
fn from(coder: T) -> SidecarBuilder<T>
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
.