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
)