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<'a, T> SidecarBuilder<T>
impl<'a, T> SidecarBuilder<T>
sourcepub fn build_arbitrary(&self) -> BlobTransactionSidecar
Available on crate feature arbitrary
only.
pub fn build_arbitrary(&self) -> BlobTransactionSidecar
arbitrary
only.Builds an arbitrary realization for BlobTransactionSidecar.
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 build_with_settings(
self,
settings: &KZGSettings,
) -> Result<BlobTransactionSidecar, Error>
Available on crate feature kzg
only.
pub fn build_with_settings( self, settings: &KZGSettings, ) -> Result<BlobTransactionSidecar, Error>
kzg
only.Build the sidecar from the data with the provided settings.
sourcepub fn build(self) -> Result<BlobTransactionSidecar, Error>
Available on crate feature kzg
only.
pub fn build(self) -> Result<BlobTransactionSidecar, Error>
kzg
only.Build the sidecar from the data, with default (Ethereum Mainnet) settings.
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
.
source§impl<T, R> FromIterator<R> for SidecarBuilder<T>
impl<T, R> FromIterator<R> for SidecarBuilder<T>
source§fn from_iter<I>(iter: I) -> SidecarBuilder<T>where
I: IntoIterator<Item = R>,
fn from_iter<I>(iter: I) -> SidecarBuilder<T>where
I: IntoIterator<Item = R>,
Auto Trait Implementations§
impl<T> Freeze for SidecarBuilder<T>where
T: Freeze,
impl<T> RefUnwindSafe for SidecarBuilder<T>where
T: RefUnwindSafe,
impl<T> Send for SidecarBuilder<T>where
T: Send,
impl<T> Sync for SidecarBuilder<T>where
T: Sync,
impl<T> Unpin for SidecarBuilder<T>where
T: Unpin,
impl<T> UnwindSafe for SidecarBuilder<T>where
T: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)