builder functions for GethDefaultTracingOptions (#4956)

This commit is contained in:
DoTheBestToGetTheBest
2023-10-09 09:17:41 -07:00
committed by GitHub
parent e823c4082d
commit b62db459d4

View File

@ -347,6 +347,88 @@ pub struct GethDefaultTracingOptions {
}
impl GethDefaultTracingOptions {
/// Enables memory capture.
pub fn enable_memory(self) -> Self {
self.with_enable_memory(true)
}
/// Disables memory capture.
pub fn disable_memory(self) -> Self {
self.with_disable_memory(true)
}
/// Disables stack capture.
pub fn disable_stack(self) -> Self {
self.with_disable_stack(true)
}
/// Disables storage capture.
pub fn disable_storage(self) -> Self {
self.with_disable_storage(true)
}
/// Enables return data capture.
pub fn enable_return_data(self) -> Self {
self.with_enable_return_data(true)
}
/// Disables return data capture.
pub fn disable_return_data(self) -> Self {
self.with_disable_return_data(true)
}
/// Enables debug mode.
pub fn debug(self) -> Self {
self.with_debug(true)
}
/// Sets the enable_memory field.
pub fn with_enable_memory(mut self, enable: bool) -> Self {
self.enable_memory = Some(enable);
self
}
/// Sets the disable_memory field.
pub fn with_disable_memory(mut self, disable: bool) -> Self {
self.disable_memory = Some(disable);
self
}
/// Sets the disable_stack field.
pub fn with_disable_stack(mut self, disable: bool) -> Self {
self.disable_stack = Some(disable);
self
}
/// Sets the disable_storage field.
pub fn with_disable_storage(mut self, disable: bool) -> Self {
self.disable_storage = Some(disable);
self
}
/// Sets the enable_return_data field.
pub fn with_enable_return_data(mut self, enable: bool) -> Self {
self.enable_return_data = Some(enable);
self
}
/// Sets the disable_return_data field.
pub fn with_disable_return_data(mut self, disable: bool) -> Self {
self.disable_return_data = Some(disable);
self
}
/// Sets the debug field.
pub fn with_debug(mut self, debug: bool) -> Self {
self.debug = Some(debug);
self
}
/// Sets the limit field.
pub fn with_limit(mut self, limit: u64) -> Self {
self.limit = Some(limit);
self
}
/// Returns `true` if return data capture is enabled
pub fn is_return_data_enabled(&self) -> bool {
self.enable_return_data
@ -369,7 +451,6 @@ impl GethDefaultTracingOptions {
!self.disable_storage.unwrap_or(false)
}
}
/// Bindings for additional `debug_traceCall` options
///
/// See <https://geth.ethereum.org/docs/rpc/ns-debug#debug_tracecall>