pub struct TranscriptBuilder { /* private fields */ }Expand description
The TranscriptBuilder struct is responsible for constructing a transcript of input data.
It contains a domain for unique identification, a data vector to hold the input data,
and an optional prefix for new labels.
§Examples
use ink_quill::TranscriptBuilder;
let mut builder = TranscriptBuilder::empty("example domain");
builder = builder.with("label", &123u64);
let result = builder.compile();§Panics
Methods of this struct may panic if called with a duplicated label. To avoid this, ensure labels are unique and do not repeat.
§Notes
- The
domainfield is not just for descriptive purposes. It’s used as a key in the Blake3 hashing function, so changing it will result in different hashes for the same input data. - Methods of this struct may panic if called with a duplicated label. To avoid this, ensure labels are unique and do not repeat.
Implementations§
Source§impl TranscriptBuilder
impl TranscriptBuilder
pub fn empty(domain: impl Into<String>) -> Self
pub fn get_domain(&self) -> &str
Sourcepub fn merge(self, other: Self) -> Self
pub fn merge(self, other: Self) -> Self
Merges another TranscriptBuilder instance into the current one. The function mutates the
current instance, extending its data with the data from the other instance. The function
consumes the other instance and returns the current instance.
Sourcepub fn with_prefix(self, prefix: String) -> Self
pub fn with_prefix(self, prefix: String) -> Self
Set a prefix for the new values passed to the transcript builder, this can be used when you want to use the transcript builder in a loop.
Sourcepub fn with<T: TranscriptBuilderInput>(
self,
label: &'static str,
data: &T,
) -> Self
pub fn with<T: TranscriptBuilderInput>( self, label: &'static str, data: &T, ) -> Self
Provide the builder with the given input and label, the label MUST be unique. The ordering of the data does not matter.