pub struct FieldSelection {
pub block: BTreeSet<BlockField>,
pub transaction: BTreeSet<TransactionField>,
pub log: BTreeSet<LogField>,
pub trace: BTreeSet<TraceField>,
}Fields§
§block: BTreeSet<BlockField>§transaction: BTreeSet<TransactionField>§log: BTreeSet<LogField>§trace: BTreeSet<TraceField>Implementations§
Source§impl FieldSelection
impl FieldSelection
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new empty field selection.
This creates a field selection with no fields selected. You can then use the builder methods to select specific fields for each data type (block, transaction, log, trace).
§Examples
use hypersync_net_types::FieldSelection;
// Create empty field selection
let field_selection = FieldSelection::new();
// All field sets are empty by default
assert!(field_selection.block.is_empty());
assert!(field_selection.transaction.is_empty());
assert!(field_selection.log.is_empty());
assert!(field_selection.trace.is_empty());Sourcepub fn block<T: IntoIterator<Item = BlockField>>(self, fields: T) -> Self
pub fn block<T: IntoIterator<Item = BlockField>>(self, fields: T) -> Self
Select specific block fields to include in query results.
This method allows you to specify which block fields should be returned in the query response. Only the selected fields will be included, which can improve performance and reduce payload size.
§Arguments
fields- An iterable ofBlockFieldvalues to select
§Examples
use hypersync_net_types::{FieldSelection, block::BlockField, transaction::TransactionField};
// Select specific block fields
let field_selection = FieldSelection::new()
.block([BlockField::Number, BlockField::Hash, BlockField::Timestamp]);
// Select all block fields for comprehensive data
let field_selection = FieldSelection::new()
.block(BlockField::all());
// Can also use a vector for specific fields
let fields = vec![BlockField::Number, BlockField::ParentHash];
let field_selection = FieldSelection::new()
.block(fields);
// Chain with other field selections - mix all and specific
let field_selection = FieldSelection::new()
.block(BlockField::all())
.transaction([TransactionField::Hash]);Sourcepub fn transaction<T: IntoIterator<Item = TransactionField>>(
self,
fields: T,
) -> Self
pub fn transaction<T: IntoIterator<Item = TransactionField>>( self, fields: T, ) -> Self
Select specific transaction fields to include in query results.
This method allows you to specify which transaction fields should be returned in the query response. Only the selected fields will be included, which can improve performance and reduce payload size.
§Arguments
fields- An iterable ofTransactionFieldvalues to select
§Examples
use hypersync_net_types::{FieldSelection, transaction::TransactionField, block::BlockField};
// Select specific transaction fields
let field_selection = FieldSelection::new()
.transaction([TransactionField::Hash, TransactionField::From, TransactionField::To]);
// Select all transaction fields for complete transaction data
let field_selection = FieldSelection::new()
.transaction(TransactionField::all());
// Select fields related to gas and value
let field_selection = FieldSelection::new()
.transaction([
TransactionField::GasPrice,
TransactionField::GasUsed,
TransactionField::Value,
]);
// Chain with other field selections - mix all and specific
let field_selection = FieldSelection::new()
.block([BlockField::Number])
.transaction(TransactionField::all());Sourcepub fn log<T: IntoIterator<Item = LogField>>(self, fields: T) -> Self
pub fn log<T: IntoIterator<Item = LogField>>(self, fields: T) -> Self
Select specific log fields to include in query results.
This method allows you to specify which log fields should be returned in the query response. Only the selected fields will be included, which can improve performance and reduce payload size.
§Arguments
fields- An iterable ofLogFieldvalues to select
§Examples
use hypersync_net_types::{FieldSelection, log::LogField, transaction::TransactionField};
// Select essential log fields
let field_selection = FieldSelection::new()
.log([LogField::Address, LogField::Data, LogField::Topic0]);
// Select all log fields for comprehensive event data
let field_selection = FieldSelection::new()
.log(LogField::all());
// Select all topic fields for event analysis
let field_selection = FieldSelection::new()
.log([
LogField::Topic0,
LogField::Topic1,
LogField::Topic2,
LogField::Topic3,
]);
// Chain with transaction fields - mix all and specific
let field_selection = FieldSelection::new()
.transaction([TransactionField::Hash])
.log(LogField::all());Sourcepub fn trace<T: IntoIterator<Item = TraceField>>(self, fields: T) -> Self
pub fn trace<T: IntoIterator<Item = TraceField>>(self, fields: T) -> Self
Select specific trace fields to include in query results.
This method allows you to specify which trace fields should be returned in the query response. Only the selected fields will be included, which can improve performance and reduce payload size.
§Availability
Note: Trace data is only available on select hypersync instances. Not all blockchain networks provide trace data, and it requires additional infrastructure to collect and serve. Check your hypersync instance documentation to confirm trace availability for your target network.
§Arguments
fields- An iterable ofTraceFieldvalues to select
§Examples
use hypersync_net_types::{
FieldSelection,
trace::TraceField,
transaction::TransactionField,
log::LogField
};
// Select basic trace information
let field_selection = FieldSelection::new()
.trace([TraceField::From, TraceField::To, TraceField::Value]);
// Select all trace fields for comprehensive trace analysis
let field_selection = FieldSelection::new()
.trace(TraceField::all());
// Select trace execution details
let field_selection = FieldSelection::new()
.trace([
TraceField::CallType,
TraceField::Input,
TraceField::Output,
TraceField::Gas,
TraceField::GasUsed,
]);
// Combine with other data types - mix all and specific
let field_selection = FieldSelection::new()
.transaction([TransactionField::Hash])
.trace(TraceField::all())
.log([LogField::Address]);Trait Implementations§
Source§impl CapnpBuilder<Owned> for FieldSelection
impl CapnpBuilder<Owned> for FieldSelection
Source§impl CapnpReader<Owned> for FieldSelection
impl CapnpReader<Owned> for FieldSelection
Source§impl Clone for FieldSelection
impl Clone for FieldSelection
Source§fn clone(&self) -> FieldSelection
fn clone(&self) -> FieldSelection
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more