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: Arbitrary<'a> + Clone> SidecarBuilder<T>
impl<'a, T: Arbitrary<'a> + Clone> 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: 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.
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.
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
.
Source§impl<T, R> FromIterator<R> for SidecarBuilder<T>
impl<T, R> FromIterator<R> for SidecarBuilder<T>
Source§fn from_iter<I: IntoIterator<Item = R>>(iter: I) -> Self
fn from_iter<I: IntoIterator<Item = R>>(iter: I) -> Self
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
)Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more