pub struct SignatureCache { /* private fields */ }Expand description
Signature cache manager
Implementations§
Source§impl SignatureCache
impl SignatureCache
Sourcepub fn default_cache_path() -> PathBuf
pub fn default_cache_path() -> PathBuf
Get the default cache directory path
Sourcepub fn get_function(&self, selector: &str) -> Option<String>
pub fn get_function(&self, selector: &str) -> Option<String>
Get function signature by 4-byte selector
Sourcepub fn set_function(&self, selector: &str, signature: &str)
pub fn set_function(&self, selector: &str, signature: &str)
Set function signature
Sourcepub fn set_events_batch(&self, entries: &[(String, String)])
pub fn set_events_batch(&self, entries: &[(String, String)])
Batch set multiple event signatures
Sourcepub fn set_functions_batch(&self, entries: &[(String, String)])
pub fn set_functions_batch(&self, entries: &[(String, String)])
Batch set multiple function signatures
Sourcepub fn is_not_found(&self, key: &str) -> bool
pub fn is_not_found(&self, key: &str) -> bool
Check if a key is in the negative cache (recently looked up but not found)
Returns true if we should skip looking this up again
Sourcepub fn set_not_found(&self, key: &str)
pub fn set_not_found(&self, key: &str)
Mark a key as not found (for negative caching)
Sourcepub fn clear_not_found(&self, key: &str)
pub fn clear_not_found(&self, key: &str)
Remove a key from the negative cache (when it’s been found elsewhere)
Sourcepub fn get_abi(
&self,
chain_id: u64,
address: &str,
) -> Option<(String, Option<String>)>
pub fn get_abi( &self, chain_id: u64, address: &str, ) -> Option<(String, Option<String>)>
Get cached ABI for a contract
Sourcepub fn set_abi(
&self,
chain_id: u64,
address: &str,
abi: &str,
name: Option<&str>,
)
pub fn set_abi( &self, chain_id: u64, address: &str, abi: &str, name: Option<&str>, )
Cache an ABI for a contract
Sourcepub fn find_function_in_abis(&self, selector: &[u8; 4]) -> Option<String>
pub fn find_function_in_abis(&self, selector: &[u8; 4]) -> Option<String>
Search all cached ABIs for a function matching the given selector
Returns the function signature string if found (e.g., “transfer(address,uint256)”)
Sourcepub fn find_event_in_abis(&self, topic0: &[u8; 32]) -> Option<String>
pub fn find_event_in_abis(&self, topic0: &[u8; 32]) -> Option<String>
Search all cached ABIs for an event matching the given topic0
Returns the event signature string if found (e.g., “Transfer(address,address,uint256)”)
Sourcepub fn stats(&self) -> CacheStats
pub fn stats(&self) -> CacheStats
Get cache statistics
Trait Implementations§
Source§impl Default for SignatureCache
impl Default for SignatureCache
Auto Trait Implementations§
impl !Freeze for SignatureCache
impl !RefUnwindSafe for SignatureCache
impl Send for SignatureCache
impl Sync for SignatureCache
impl Unpin for SignatureCache
impl UnwindSafe for SignatureCache
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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