FieldSelection

Struct FieldSelection 

Source
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

Source

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());
Source

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 of BlockField values 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]);
Source

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 of TransactionField values 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());
Source

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 of LogField values 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());
Source

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 of TraceField values 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

Source§

fn populate_builder( &self, field_selection: &mut Builder<'_>, ) -> Result<(), Error>

Source§

impl CapnpReader<Owned> for FieldSelection

Source§

fn from_reader(fs: Reader<'_>) -> Result<Self, Error>

Source§

impl Clone for FieldSelection

Source§

fn clone(&self) -> FieldSelection

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for FieldSelection

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for FieldSelection

Source§

fn default() -> FieldSelection

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for FieldSelection

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for FieldSelection

Source§

fn eq(&self, other: &FieldSelection) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for FieldSelection

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for FieldSelection

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,