Type Alias ExecuteFrameHandle
pub type ExecuteFrameHandle<'a, EXT, DB> = Arc<dyn Fn(&mut Frame, &mut SharedMemory, &InstructionTables<'_, Context<EXT, DB>>, &mut Context<EXT, DB>) -> Result<InterpreterAction, EVMError<<DB as Database>::Error>> + 'a>;
Expand description
Executes a single frame. Errors can be returned in the EVM context.
Aliased Type§
struct ExecuteFrameHandle<'a, EXT, DB> { /* private fields */ }
Layout§
Note: Encountered an error during type layout; the type failed to be normalized.
Implementations
Source§impl<T> Arc<T>where
T: ?Sized,
impl<T> Arc<T>where
T: ?Sized,
1.17.0 · Sourcepub unsafe fn from_raw(ptr: *const T) -> Arc<T>
pub unsafe fn from_raw(ptr: *const T) -> Arc<T>
Constructs an Arc<T>
from a raw pointer.
The raw pointer must have been previously returned by a call to
Arc<U>::into_raw
with the following requirements:
- If
U
is sized, it must have the same size and alignment asT
. This is trivially true ifU
isT
. - If
U
is unsized, its data pointer must have the same size and alignment asT
. This is trivially true ifArc<U>
was constructed throughArc<T>
and then converted toArc<U>
through an unsized coercion.
Note that if U
or U
’s data pointer is not T
but has the same size
and alignment, this is basically like transmuting references of
different types. See mem::transmute
for more information
on what restrictions apply in this case.
The user of from_raw
has to make sure a specific value of T
is only
dropped once.
This function is unsafe because improper use may lead to memory unsafety,
even if the returned Arc<T>
is never accessed.
§Examples
use std::sync::Arc;
let x = Arc::new("hello".to_owned());
let x_ptr = Arc::into_raw(x);
unsafe {
// Convert back to an `Arc` to prevent leak.
let x = Arc::from_raw(x_ptr);
assert_eq!(&*x, "hello");
// Further calls to `Arc::from_raw(x_ptr)` would be memory-unsafe.
}
// The memory was freed when `x` went out of scope above, so `x_ptr` is now dangling!
Convert a slice back into its original array:
use std::sync::Arc;
let x: Arc<[u32]> = Arc::new([1, 2, 3]);
let x_ptr: *const [u32] = Arc::into_raw(x);
unsafe {
let x: Arc<[u32; 3]> = Arc::from_raw(x_ptr.cast::<[u32; 3]>());
assert_eq!(&*x, &[1, 2, 3]);
}
1.51.0 · Sourcepub unsafe fn increment_strong_count(ptr: *const T)
pub unsafe fn increment_strong_count(ptr: *const T)
Increments the strong reference count on the Arc<T>
associated with the
provided pointer by one.
§Safety
The pointer must have been obtained through Arc::into_raw
, and the
associated Arc
instance must be valid (i.e. the strong count must be at
least 1) for the duration of this method.
§Examples
use std::sync::Arc;
let five = Arc::new(5);
unsafe {
let ptr = Arc::into_raw(five);
Arc::increment_strong_count(ptr);
// This assertion is deterministic because we haven't shared
// the `Arc` between threads.
let five = Arc::from_raw(ptr);
assert_eq!(2, Arc::strong_count(&five));
}
1.51.0 · Sourcepub unsafe fn decrement_strong_count(ptr: *const T)
pub unsafe fn decrement_strong_count(ptr: *const T)
Decrements the strong reference count on the Arc<T>
associated with the
provided pointer by one.
§Safety
The pointer must have been obtained through Arc::into_raw
, and the
associated Arc
instance must be valid (i.e. the strong count must be at
least 1) when invoking this method. This method can be used to release the final
Arc
and backing storage, but should not be called after the final Arc
has been
released.
§Examples
use std::sync::Arc;
let five = Arc::new(5);
unsafe {
let ptr = Arc::into_raw(five);
Arc::increment_strong_count(ptr);
// Those assertions are deterministic because we haven't shared
// the `Arc` between threads.
let five = Arc::from_raw(ptr);
assert_eq!(2, Arc::strong_count(&five));
Arc::decrement_strong_count(ptr);
assert_eq!(1, Arc::strong_count(&five));
}
Source§impl<T> Arc<T>
impl<T> Arc<T>
1.60.0 · Sourcepub fn new_cyclic<F>(data_fn: F) -> Arc<T>
Available on non-no_global_oom_handling
only.
pub fn new_cyclic<F>(data_fn: F) -> Arc<T>
no_global_oom_handling
only.Constructs a new Arc<T>
while giving you a Weak<T>
to the allocation,
to allow you to construct a T
which holds a weak pointer to itself.
Generally, a structure circularly referencing itself, either directly or
indirectly, should not hold a strong reference to itself to prevent a memory leak.
Using this function, you get access to the weak pointer during the
initialization of T
, before the Arc<T>
is created, such that you can
clone and store it inside the T
.
new_cyclic
first allocates the managed allocation for the Arc<T>
,
then calls your closure, giving it a Weak<T>
to this allocation,
and only afterwards completes the construction of the Arc<T>
by placing
the T
returned from your closure into the allocation.
Since the new Arc<T>
is not fully-constructed until Arc<T>::new_cyclic
returns, calling upgrade
on the weak reference inside your closure will
fail and result in a None
value.
§Panics
If data_fn
panics, the panic is propagated to the caller, and the
temporary Weak<T>
is dropped normally.
§Example
use std::sync::{Arc, Weak};
struct Gadget {
me: Weak<Gadget>,
}
impl Gadget {
/// Constructs a reference counted Gadget.
fn new() -> Arc<Self> {
// `me` is a `Weak<Gadget>` pointing at the new allocation of the
// `Arc` we're constructing.
Arc::new_cyclic(|me| {
// Create the actual struct here.
Gadget { me: me.clone() }
})
}
/// Returns a reference counted pointer to Self.
fn me(&self) -> Arc<Self> {
self.me.upgrade().unwrap()
}
}
1.82.0 · Sourcepub fn new_uninit() -> Arc<MaybeUninit<T>>
Available on non-no_global_oom_handling
only.
pub fn new_uninit() -> Arc<MaybeUninit<T>>
no_global_oom_handling
only.Constructs a new Arc
with uninitialized contents.
§Examples
#![feature(get_mut_unchecked)]
use std::sync::Arc;
let mut five = Arc::<u32>::new_uninit();
// Deferred initialization:
Arc::get_mut(&mut five).unwrap().write(5);
let five = unsafe { five.assume_init() };
assert_eq!(*five, 5)
Sourcepub fn new_zeroed() -> Arc<MaybeUninit<T>>
🔬This is a nightly-only experimental API. (new_zeroed_alloc
#129396)Available on non-no_global_oom_handling
only.
pub fn new_zeroed() -> Arc<MaybeUninit<T>>
new_zeroed_alloc
#129396)no_global_oom_handling
only.Constructs a new Arc
with uninitialized contents, with the memory
being filled with 0
bytes.
See MaybeUninit::zeroed
for examples of correct and incorrect usage
of this method.
§Examples
#![feature(new_zeroed_alloc)]
use std::sync::Arc;
let zero = Arc::<u32>::new_zeroed();
let zero = unsafe { zero.assume_init() };
assert_eq!(*zero, 0)
1.33.0 · Sourcepub fn pin(data: T) -> Pin<Arc<T>>
Available on non-no_global_oom_handling
only.
pub fn pin(data: T) -> Pin<Arc<T>>
no_global_oom_handling
only.Constructs a new Pin<Arc<T>>
. If T
does not implement Unpin
, then
data
will be pinned in memory and unable to be moved.
Sourcepub fn try_pin(data: T) -> Result<Pin<Arc<T>>, AllocError>
🔬This is a nightly-only experimental API. (allocator_api
#32838)
pub fn try_pin(data: T) -> Result<Pin<Arc<T>>, AllocError>
allocator_api
#32838)Constructs a new Pin<Arc<T>>
, return an error if allocation fails.
Sourcepub fn try_new(data: T) -> Result<Arc<T>, AllocError>
🔬This is a nightly-only experimental API. (allocator_api
#32838)
pub fn try_new(data: T) -> Result<Arc<T>, AllocError>
allocator_api
#32838)Constructs a new Arc<T>
, returning an error if allocation fails.
§Examples
#![feature(allocator_api)]
use std::sync::Arc;
let five = Arc::try_new(5)?;
Sourcepub fn try_new_uninit() -> Result<Arc<MaybeUninit<T>>, AllocError>
🔬This is a nightly-only experimental API. (allocator_api
#32838)
pub fn try_new_uninit() -> Result<Arc<MaybeUninit<T>>, AllocError>
allocator_api
#32838)Constructs a new Arc
with uninitialized contents, returning an error
if allocation fails.
§Examples
#![feature(allocator_api)]
#![feature(get_mut_unchecked)]
use std::sync::Arc;
let mut five = Arc::<u32>::try_new_uninit()?;
// Deferred initialization:
Arc::get_mut(&mut five).unwrap().write(5);
let five = unsafe { five.assume_init() };
assert_eq!(*five, 5);
Sourcepub fn try_new_zeroed() -> Result<Arc<MaybeUninit<T>>, AllocError>
🔬This is a nightly-only experimental API. (allocator_api
#32838)
pub fn try_new_zeroed() -> Result<Arc<MaybeUninit<T>>, AllocError>
allocator_api
#32838)Constructs a new Arc
with uninitialized contents, with the memory
being filled with 0
bytes, returning an error if allocation fails.
See MaybeUninit::zeroed
for examples of correct and incorrect usage
of this method.
§Examples
#![feature( allocator_api)]
use std::sync::Arc;
let zero = Arc::<u32>::try_new_zeroed()?;
let zero = unsafe { zero.assume_init() };
assert_eq!(*zero, 0);
Source§impl<T, A> Arc<T, A>
impl<T, A> Arc<T, A>
Sourcepub fn allocator(this: &Arc<T, A>) -> &A
🔬This is a nightly-only experimental API. (allocator_api
#32838)
pub fn allocator(this: &Arc<T, A>) -> &A
allocator_api
#32838)Returns a reference to the underlying allocator.
Note: this is an associated function, which means that you have
to call it as Arc::allocator(&a)
instead of a.allocator()
. This
is so that there is no conflict with a method on the inner type.
1.17.0 · Sourcepub fn into_raw(this: Arc<T, A>) -> *const T
pub fn into_raw(this: Arc<T, A>) -> *const T
Consumes the Arc
, returning the wrapped pointer.
To avoid a memory leak the pointer must be converted back to an Arc
using
Arc::from_raw
.
§Examples
use std::sync::Arc;
let x = Arc::new("hello".to_owned());
let x_ptr = Arc::into_raw(x);
assert_eq!(unsafe { &*x_ptr }, "hello");
Sourcepub fn into_raw_with_allocator(this: Arc<T, A>) -> (*const T, A)
🔬This is a nightly-only experimental API. (allocator_api
#32838)
pub fn into_raw_with_allocator(this: Arc<T, A>) -> (*const T, A)
allocator_api
#32838)Consumes the Arc
, returning the wrapped pointer and allocator.
To avoid a memory leak the pointer must be converted back to an Arc
using
Arc::from_raw_in
.
§Examples
#![feature(allocator_api)]
use std::sync::Arc;
use std::alloc::System;
let x = Arc::new_in("hello".to_owned(), System);
let (ptr, alloc) = Arc::into_raw_with_allocator(x);
assert_eq!(unsafe { &*ptr }, "hello");
let x = unsafe { Arc::from_raw_in(ptr, alloc) };
assert_eq!(&*x, "hello");
1.45.0 · Sourcepub fn as_ptr(this: &Arc<T, A>) -> *const T
pub fn as_ptr(this: &Arc<T, A>) -> *const T
Provides a raw pointer to the data.
The counts are not affected in any way and the Arc
is not consumed. The pointer is valid for
as long as there are strong counts in the Arc
.
§Examples
use std::sync::Arc;
let x = Arc::new("hello".to_owned());
let y = Arc::clone(&x);
let x_ptr = Arc::as_ptr(&x);
assert_eq!(x_ptr, Arc::as_ptr(&y));
assert_eq!(unsafe { &*x_ptr }, "hello");
Sourcepub unsafe fn from_raw_in(ptr: *const T, alloc: A) -> Arc<T, A>
🔬This is a nightly-only experimental API. (allocator_api
#32838)
pub unsafe fn from_raw_in(ptr: *const T, alloc: A) -> Arc<T, A>
allocator_api
#32838)Constructs an Arc<T, A>
from a raw pointer.
The raw pointer must have been previously returned by a call to Arc<U, A>::into_raw
with the following requirements:
- If
U
is sized, it must have the same size and alignment asT
. This is trivially true ifU
isT
. - If
U
is unsized, its data pointer must have the same size and alignment asT
. This is trivially true ifArc<U>
was constructed throughArc<T>
and then converted toArc<U>
through an unsized coercion.
Note that if U
or U
’s data pointer is not T
but has the same size
and alignment, this is basically like transmuting references of
different types. See mem::transmute
for more information
on what restrictions apply in this case.
The raw pointer must point to a block of memory allocated by alloc
The user of from_raw
has to make sure a specific value of T
is only
dropped once.
This function is unsafe because improper use may lead to memory unsafety,
even if the returned Arc<T>
is never accessed.
§Examples
#![feature(allocator_api)]
use std::sync::Arc;
use std::alloc::System;
let x = Arc::new_in("hello".to_owned(), System);
let x_ptr = Arc::into_raw(x);
unsafe {
// Convert back to an `Arc` to prevent leak.
let x = Arc::from_raw_in(x_ptr, System);
assert_eq!(&*x, "hello");
// Further calls to `Arc::from_raw(x_ptr)` would be memory-unsafe.
}
// The memory was freed when `x` went out of scope above, so `x_ptr` is now dangling!
Convert a slice back into its original array:
#![feature(allocator_api)]
use std::sync::Arc;
use std::alloc::System;
let x: Arc<[u32], _> = Arc::new_in([1, 2, 3], System);
let x_ptr: *const [u32] = Arc::into_raw(x);
unsafe {
let x: Arc<[u32; 3], _> = Arc::from_raw_in(x_ptr.cast::<[u32; 3]>(), System);
assert_eq!(&*x, &[1, 2, 3]);
}
1.15.0 · Sourcepub fn weak_count(this: &Arc<T, A>) -> usize
pub fn weak_count(this: &Arc<T, A>) -> usize
Gets the number of Weak
pointers to this allocation.
§Safety
This method by itself is safe, but using it correctly requires extra care. Another thread can change the weak count at any time, including potentially between calling this method and acting on the result.
§Examples
use std::sync::Arc;
let five = Arc::new(5);
let _weak_five = Arc::downgrade(&five);
// This assertion is deterministic because we haven't shared
// the `Arc` or `Weak` between threads.
assert_eq!(1, Arc::weak_count(&five));
1.15.0 · Sourcepub fn strong_count(this: &Arc<T, A>) -> usize
pub fn strong_count(this: &Arc<T, A>) -> usize
Gets the number of strong (Arc
) pointers to this allocation.
§Safety
This method by itself is safe, but using it correctly requires extra care. Another thread can change the strong count at any time, including potentially between calling this method and acting on the result.
§Examples
use std::sync::Arc;
let five = Arc::new(5);
let _also_five = Arc::clone(&five);
// This assertion is deterministic because we haven't shared
// the `Arc` between threads.
assert_eq!(2, Arc::strong_count(&five));
Sourcepub unsafe fn increment_strong_count_in(ptr: *const T, alloc: A)where
A: Clone,
🔬This is a nightly-only experimental API. (allocator_api
#32838)
pub unsafe fn increment_strong_count_in(ptr: *const T, alloc: A)where
A: Clone,
allocator_api
#32838)Increments the strong reference count on the Arc<T>
associated with the
provided pointer by one.
§Safety
The pointer must have been obtained through Arc::into_raw
, and the
associated Arc
instance must be valid (i.e. the strong count must be at
least 1) for the duration of this method,, and ptr
must point to a block of memory
allocated by alloc
.
§Examples
#![feature(allocator_api)]
use std::sync::Arc;
use std::alloc::System;
let five = Arc::new_in(5, System);
unsafe {
let ptr = Arc::into_raw(five);
Arc::increment_strong_count_in(ptr, System);
// This assertion is deterministic because we haven't shared
// the `Arc` between threads.
let five = Arc::from_raw_in(ptr, System);
assert_eq!(2, Arc::strong_count(&five));
}
Sourcepub unsafe fn decrement_strong_count_in(ptr: *const T, alloc: A)
🔬This is a nightly-only experimental API. (allocator_api
#32838)
pub unsafe fn decrement_strong_count_in(ptr: *const T, alloc: A)
allocator_api
#32838)Decrements the strong reference count on the Arc<T>
associated with the
provided pointer by one.
§Safety
The pointer must have been obtained through Arc::into_raw
, the
associated Arc
instance must be valid (i.e. the strong count must be at
least 1) when invoking this method, and ptr
must point to a block of memory
allocated by alloc
. This method can be used to release the final
Arc
and backing storage, but should not be called after the final Arc
has been
released.
§Examples
#![feature(allocator_api)]
use std::sync::Arc;
use std::alloc::System;
let five = Arc::new_in(5, System);
unsafe {
let ptr = Arc::into_raw(five);
Arc::increment_strong_count_in(ptr, System);
// Those assertions are deterministic because we haven't shared
// the `Arc` between threads.
let five = Arc::from_raw_in(ptr, System);
assert_eq!(2, Arc::strong_count(&five));
Arc::decrement_strong_count_in(ptr, System);
assert_eq!(1, Arc::strong_count(&five));
}
1.17.0 · Sourcepub fn ptr_eq(this: &Arc<T, A>, other: &Arc<T, A>) -> bool
pub fn ptr_eq(this: &Arc<T, A>, other: &Arc<T, A>) -> bool
Returns true
if the two Arc
s point to the same allocation in a vein similar to
ptr::eq
. This function ignores the metadata of dyn Trait
pointers.
§Examples
use std::sync::Arc;
let five = Arc::new(5);
let same_five = Arc::clone(&five);
let other_five = Arc::new(5);
assert!(Arc::ptr_eq(&five, &same_five));
assert!(!Arc::ptr_eq(&five, &other_five));
Source§impl<T, A> Arc<T, A>
impl<T, A> Arc<T, A>
1.4.0 · Sourcepub fn make_mut(this: &mut Arc<T, A>) -> &mut T
Available on non-no_global_oom_handling
only.
pub fn make_mut(this: &mut Arc<T, A>) -> &mut T
no_global_oom_handling
only.Makes a mutable reference into the given Arc
.
If there are other Arc
pointers to the same allocation, then make_mut
will
clone
the inner value to a new allocation to ensure unique ownership. This is also
referred to as clone-on-write.
However, if there are no other Arc
pointers to this allocation, but some Weak
pointers, then the Weak
pointers will be dissociated and the inner value will not
be cloned.
See also get_mut
, which will fail rather than cloning the inner value
or dissociating Weak
pointers.
§Examples
use std::sync::Arc;
let mut data = Arc::new(5);
*Arc::make_mut(&mut data) += 1; // Won't clone anything
let mut other_data = Arc::clone(&data); // Won't clone inner data
*Arc::make_mut(&mut data) += 1; // Clones inner data
*Arc::make_mut(&mut data) += 1; // Won't clone anything
*Arc::make_mut(&mut other_data) *= 2; // Won't clone anything
// Now `data` and `other_data` point to different allocations.
assert_eq!(*data, 8);
assert_eq!(*other_data, 12);
Weak
pointers will be dissociated:
use std::sync::Arc;
let mut data = Arc::new(75);
let weak = Arc::downgrade(&data);
assert!(75 == *data);
assert!(75 == *weak.upgrade().unwrap());
*Arc::make_mut(&mut data) += 1;
assert!(76 == *data);
assert!(weak.upgrade().is_none());
Source§impl<T, A> Arc<T, A>
impl<T, A> Arc<T, A>
1.76.0 · Sourcepub fn unwrap_or_clone(this: Arc<T, A>) -> T
pub fn unwrap_or_clone(this: Arc<T, A>) -> T
If we have the only reference to T
then unwrap it. Otherwise, clone T
and return the
clone.
Assuming arc_t
is of type Arc<T>
, this function is functionally equivalent to
(*arc_t).clone()
, but will avoid cloning the inner value where possible.
§Examples
let inner = String::from("test");
let ptr = inner.as_ptr();
let arc = Arc::new(inner);
let inner = Arc::unwrap_or_clone(arc);
// The inner value was not cloned
assert!(ptr::eq(ptr, inner.as_ptr()));
let arc = Arc::new(inner);
let arc2 = arc.clone();
let inner = Arc::unwrap_or_clone(arc);
// Because there were 2 references, we had to clone the inner value.
assert!(!ptr::eq(ptr, inner.as_ptr()));
// `arc2` is the last reference, so when we unwrap it we get back
// the original `String`.
let inner = Arc::unwrap_or_clone(arc2);
assert!(ptr::eq(ptr, inner.as_ptr()));
Source§impl<T, A> Arc<T, A>
impl<T, A> Arc<T, A>
1.4.0 · Sourcepub fn get_mut(this: &mut Arc<T, A>) -> Option<&mut T>
pub fn get_mut(this: &mut Arc<T, A>) -> Option<&mut T>
Returns a mutable reference into the given Arc
, if there are
no other Arc
or Weak
pointers to the same allocation.
Returns None
otherwise, because it is not safe to
mutate a shared value.
See also make_mut
, which will clone
the inner value when there are other Arc
pointers.
§Examples
use std::sync::Arc;
let mut x = Arc::new(3);
*Arc::get_mut(&mut x).unwrap() = 4;
assert_eq!(*x, 4);
let _y = Arc::clone(&x);
assert!(Arc::get_mut(&mut x).is_none());
Sourcepub unsafe fn get_mut_unchecked(this: &mut Arc<T, A>) -> &mut T
🔬This is a nightly-only experimental API. (get_mut_unchecked
#63292)
pub unsafe fn get_mut_unchecked(this: &mut Arc<T, A>) -> &mut T
get_mut_unchecked
#63292)Returns a mutable reference into the given Arc
,
without any check.
See also get_mut
, which is safe and does appropriate checks.
§Safety
If any other Arc
or Weak
pointers to the same allocation exist, then
they must not be dereferenced or have active borrows for the duration
of the returned borrow, and their inner type must be exactly the same as the
inner type of this Rc (including lifetimes). This is trivially the case if no
such pointers exist, for example immediately after Arc::new
.
§Examples
#![feature(get_mut_unchecked)]
use std::sync::Arc;
let mut x = Arc::new(String::new());
unsafe {
Arc::get_mut_unchecked(&mut x).push_str("foo")
}
assert_eq!(*x, "foo");
Other Arc
pointers to the same allocation must be to the same type.
#![feature(get_mut_unchecked)]
use std::sync::Arc;
let x: Arc<str> = Arc::from("Hello, world!");
let mut y: Arc<[u8]> = x.clone().into();
unsafe {
// this is Undefined Behavior, because x's inner type is str, not [u8]
Arc::get_mut_unchecked(&mut y).fill(0xff); // 0xff is invalid in UTF-8
}
println!("{}", &*x); // Invalid UTF-8 in a str
Other Arc
pointers to the same allocation must be to the exact same type, including lifetimes.
#![feature(get_mut_unchecked)]
use std::sync::Arc;
let x: Arc<&str> = Arc::new("Hello, world!");
{
let s = String::from("Oh, no!");
let mut y: Arc<&str> = x.clone();
unsafe {
// this is Undefined Behavior, because x's inner type
// is &'long str, not &'short str
*Arc::get_mut_unchecked(&mut y) = &s;
}
}
println!("{}", &*x); // Use-after-free
Source§impl<T, A> Arc<T, A>where
A: Allocator,
impl<T, A> Arc<T, A>where
A: Allocator,
Sourcepub fn new_in(data: T, alloc: A) -> Arc<T, A>
🔬This is a nightly-only experimental API. (allocator_api
#32838)Available on non-no_global_oom_handling
only.
pub fn new_in(data: T, alloc: A) -> Arc<T, A>
allocator_api
#32838)no_global_oom_handling
only.Constructs a new Arc<T>
in the provided allocator.
§Examples
#![feature(allocator_api)]
use std::sync::Arc;
use std::alloc::System;
let five = Arc::new_in(5, System);
Sourcepub fn new_uninit_in(alloc: A) -> Arc<MaybeUninit<T>, A>
🔬This is a nightly-only experimental API. (allocator_api
#32838)Available on non-no_global_oom_handling
only.
pub fn new_uninit_in(alloc: A) -> Arc<MaybeUninit<T>, A>
allocator_api
#32838)no_global_oom_handling
only.Constructs a new Arc
with uninitialized contents in the provided allocator.
§Examples
#![feature(get_mut_unchecked)]
#![feature(allocator_api)]
use std::sync::Arc;
use std::alloc::System;
let mut five = Arc::<u32, _>::new_uninit_in(System);
let five = unsafe {
// Deferred initialization:
Arc::get_mut_unchecked(&mut five).as_mut_ptr().write(5);
five.assume_init()
};
assert_eq!(*five, 5)
Sourcepub fn new_zeroed_in(alloc: A) -> Arc<MaybeUninit<T>, A>
🔬This is a nightly-only experimental API. (allocator_api
#32838)Available on non-no_global_oom_handling
only.
pub fn new_zeroed_in(alloc: A) -> Arc<MaybeUninit<T>, A>
allocator_api
#32838)no_global_oom_handling
only.Constructs a new Arc
with uninitialized contents, with the memory
being filled with 0
bytes, in the provided allocator.
See MaybeUninit::zeroed
for examples of correct and incorrect usage
of this method.
§Examples
#![feature(allocator_api)]
use std::sync::Arc;
use std::alloc::System;
let zero = Arc::<u32, _>::new_zeroed_in(System);
let zero = unsafe { zero.assume_init() };
assert_eq!(*zero, 0)
Sourcepub fn new_cyclic_in<F>(data_fn: F, alloc: A) -> Arc<T, A>
🔬This is a nightly-only experimental API. (allocator_api
#32838)Available on non-no_global_oom_handling
only.
pub fn new_cyclic_in<F>(data_fn: F, alloc: A) -> Arc<T, A>
allocator_api
#32838)no_global_oom_handling
only.Constructs a new Arc<T, A>
in the given allocator while giving you a Weak<T, A>
to the allocation,
to allow you to construct a T
which holds a weak pointer to itself.
Generally, a structure circularly referencing itself, either directly or
indirectly, should not hold a strong reference to itself to prevent a memory leak.
Using this function, you get access to the weak pointer during the
initialization of T
, before the Arc<T, A>
is created, such that you can
clone and store it inside the T
.
new_cyclic_in
first allocates the managed allocation for the Arc<T, A>
,
then calls your closure, giving it a Weak<T, A>
to this allocation,
and only afterwards completes the construction of the Arc<T, A>
by placing
the T
returned from your closure into the allocation.
Since the new Arc<T, A>
is not fully-constructed until Arc<T, A>::new_cyclic_in
returns, calling upgrade
on the weak reference inside your closure will
fail and result in a None
value.
§Panics
If data_fn
panics, the panic is propagated to the caller, and the
temporary Weak<T>
is dropped normally.
§Example
See new_cyclic
Sourcepub fn pin_in(data: T, alloc: A) -> Pin<Arc<T, A>>where
A: 'static,
🔬This is a nightly-only experimental API. (allocator_api
#32838)Available on non-no_global_oom_handling
only.
pub fn pin_in(data: T, alloc: A) -> Pin<Arc<T, A>>where
A: 'static,
allocator_api
#32838)no_global_oom_handling
only.Constructs a new Pin<Arc<T, A>>
in the provided allocator. If T
does not implement Unpin
,
then data
will be pinned in memory and unable to be moved.
Sourcepub fn try_pin_in(data: T, alloc: A) -> Result<Pin<Arc<T, A>>, AllocError>where
A: 'static,
🔬This is a nightly-only experimental API. (allocator_api
#32838)
pub fn try_pin_in(data: T, alloc: A) -> Result<Pin<Arc<T, A>>, AllocError>where
A: 'static,
allocator_api
#32838)Constructs a new Pin<Arc<T, A>>
in the provided allocator, return an error if allocation
fails.
Sourcepub fn try_new_in(data: T, alloc: A) -> Result<Arc<T, A>, AllocError>
🔬This is a nightly-only experimental API. (allocator_api
#32838)
pub fn try_new_in(data: T, alloc: A) -> Result<Arc<T, A>, AllocError>
allocator_api
#32838)Constructs a new Arc<T, A>
in the provided allocator, returning an error if allocation fails.
§Examples
#![feature(allocator_api)]
use std::sync::Arc;
use std::alloc::System;
let five = Arc::try_new_in(5, System)?;
Sourcepub fn try_new_uninit_in(alloc: A) -> Result<Arc<MaybeUninit<T>, A>, AllocError>
🔬This is a nightly-only experimental API. (allocator_api
#32838)
pub fn try_new_uninit_in(alloc: A) -> Result<Arc<MaybeUninit<T>, A>, AllocError>
allocator_api
#32838)Constructs a new Arc
with uninitialized contents, in the provided allocator, returning an
error if allocation fails.
§Examples
#![feature(allocator_api)]
#![feature(get_mut_unchecked)]
use std::sync::Arc;
use std::alloc::System;
let mut five = Arc::<u32, _>::try_new_uninit_in(System)?;
let five = unsafe {
// Deferred initialization:
Arc::get_mut_unchecked(&mut five).as_mut_ptr().write(5);
five.assume_init()
};
assert_eq!(*five, 5);
Sourcepub fn try_new_zeroed_in(alloc: A) -> Result<Arc<MaybeUninit<T>, A>, AllocError>
🔬This is a nightly-only experimental API. (allocator_api
#32838)
pub fn try_new_zeroed_in(alloc: A) -> Result<Arc<MaybeUninit<T>, A>, AllocError>
allocator_api
#32838)Constructs a new Arc
with uninitialized contents, with the memory
being filled with 0
bytes, in the provided allocator, returning an error if allocation
fails.
See MaybeUninit::zeroed
for examples of correct and incorrect usage
of this method.
§Examples
#![feature(allocator_api)]
use std::sync::Arc;
use std::alloc::System;
let zero = Arc::<u32, _>::try_new_zeroed_in(System)?;
let zero = unsafe { zero.assume_init() };
assert_eq!(*zero, 0);
1.4.0 · Sourcepub fn try_unwrap(this: Arc<T, A>) -> Result<T, Arc<T, A>>
pub fn try_unwrap(this: Arc<T, A>) -> Result<T, Arc<T, A>>
Returns the inner value, if the Arc
has exactly one strong reference.
Otherwise, an Err
is returned with the same Arc
that was
passed in.
This will succeed even if there are outstanding weak references.
It is strongly recommended to use Arc::into_inner
instead if you don’t
keep the Arc
in the Err
case.
Immediately dropping the Err
-value, as the expression
Arc::try_unwrap(this).ok()
does, can cause the strong count to
drop to zero and the inner value of the Arc
to be dropped.
For instance, if two threads execute such an expression in parallel,
there is a race condition without the possibility of unsafety:
The threads could first both check whether they own the last instance
in Arc::try_unwrap
, determine that they both do not, and then both
discard and drop their instance in the call to ok
.
In this scenario, the value inside the Arc
is safely destroyed
by exactly one of the threads, but neither thread will ever be able
to use the value.
§Examples
use std::sync::Arc;
let x = Arc::new(3);
assert_eq!(Arc::try_unwrap(x), Ok(3));
let x = Arc::new(4);
let _y = Arc::clone(&x);
assert_eq!(*Arc::try_unwrap(x).unwrap_err(), 4);
1.70.0 · Sourcepub fn into_inner(this: Arc<T, A>) -> Option<T>
pub fn into_inner(this: Arc<T, A>) -> Option<T>
Returns the inner value, if the Arc
has exactly one strong reference.
Otherwise, None
is returned and the Arc
is dropped.
This will succeed even if there are outstanding weak references.
If Arc::into_inner
is called on every clone of this Arc
,
it is guaranteed that exactly one of the calls returns the inner value.
This means in particular that the inner value is not dropped.
Arc::try_unwrap
is conceptually similar to Arc::into_inner
, but it
is meant for different use-cases. If used as a direct replacement
for Arc::into_inner
anyway, such as with the expression
Arc::try_unwrap(this).ok()
, then it does
not give the same guarantee as described in the previous paragraph.
For more information, see the examples below and read the documentation
of Arc::try_unwrap
.
§Examples
Minimal example demonstrating the guarantee that Arc::into_inner
gives.
use std::sync::Arc;
let x = Arc::new(3);
let y = Arc::clone(&x);
// Two threads calling `Arc::into_inner` on both clones of an `Arc`:
let x_thread = std::thread::spawn(|| Arc::into_inner(x));
let y_thread = std::thread::spawn(|| Arc::into_inner(y));
let x_inner_value = x_thread.join().unwrap();
let y_inner_value = y_thread.join().unwrap();
// One of the threads is guaranteed to receive the inner value:
assert!(matches!(
(x_inner_value, y_inner_value),
(None, Some(3)) | (Some(3), None)
));
// The result could also be `(None, None)` if the threads called
// `Arc::try_unwrap(x).ok()` and `Arc::try_unwrap(y).ok()` instead.
A more practical example demonstrating the need for Arc::into_inner
:
use std::sync::Arc;
// Definition of a simple singly linked list using `Arc`:
#[derive(Clone)]
struct LinkedList<T>(Option<Arc<Node<T>>>);
struct Node<T>(T, Option<Arc<Node<T>>>);
// Dropping a long `LinkedList<T>` relying on the destructor of `Arc`
// can cause a stack overflow. To prevent this, we can provide a
// manual `Drop` implementation that does the destruction in a loop:
impl<T> Drop for LinkedList<T> {
fn drop(&mut self) {
let mut link = self.0.take();
while let Some(arc_node) = link.take() {
if let Some(Node(_value, next)) = Arc::into_inner(arc_node) {
link = next;
}
}
}
}
// Implementation of `new` and `push` omitted
impl<T> LinkedList<T> {
/* ... */
}
// The following code could have still caused a stack overflow
// despite the manual `Drop` impl if that `Drop` impl had used
// `Arc::try_unwrap(arc).ok()` instead of `Arc::into_inner(arc)`.
// Create a long list and clone it
let mut x = LinkedList::new();
let size = 100000;
for i in 0..size {
x.push(i); // Adds i to the front of x
}
let y = x.clone();
// Drop the clones in parallel
let x_thread = std::thread::spawn(|| drop(x));
let y_thread = std::thread::spawn(|| drop(y));
x_thread.join().unwrap();
y_thread.join().unwrap();
Trait Implementations
Source§impl<T> AccountExtReader for Arc<T>
impl<T> AccountExtReader for Arc<T>
Source§fn changed_accounts_with_range(
&self,
_range: impl RangeBounds<u64>,
) -> Result<BTreeSet<Address>, ProviderError>
fn changed_accounts_with_range( &self, _range: impl RangeBounds<u64>, ) -> Result<BTreeSet<Address>, ProviderError>
Source§fn basic_accounts(
&self,
_iter: impl IntoIterator<Item = Address>,
) -> Result<Vec<(Address, Option<Account>)>, ProviderError>
fn basic_accounts( &self, _iter: impl IntoIterator<Item = Address>, ) -> Result<Vec<(Address, Option<Account>)>, ProviderError>
AccountReader::basic_account
repeatedly. Read moreSource§impl<T> AccountReader for Arc<T>
impl<T> AccountReader for Arc<T>
§impl<T> AnyProvider for Arc<T>where
T: AnyProvider + ?Sized,
Available on target_has_atomic="ptr"
only.
impl<T> AnyProvider for Arc<T>where
T: AnyProvider + ?Sized,
target_has_atomic="ptr"
only.§impl<'a, A> Arbitrary<'a> for Arc<A>where
A: Arbitrary<'a>,
impl<'a, A> Arbitrary<'a> for Arc<A>where
A: Arbitrary<'a>,
§fn arbitrary(u: &mut Unstructured<'a>) -> Result<Arc<A>, Error>
fn arbitrary(u: &mut Unstructured<'a>) -> Result<Arc<A>, Error>
Self
from the given unstructured data. Read more§fn size_hint(depth: usize) -> (usize, Option<usize>)
fn size_hint(depth: usize) -> (usize, Option<usize>)
Unstructured
this type
needs to construct itself. Read more§fn try_size_hint(
depth: usize,
) -> Result<(usize, Option<usize>), MaxRecursionReached>
fn try_size_hint( depth: usize, ) -> Result<(usize, Option<usize>), MaxRecursionReached>
Unstructured
this type
needs to construct itself. Read more§fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>
fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>
Self
from the entirety of the given
unstructured data. Read more§impl<A> Arbitrary for Arc<A>where
A: Arbitrary,
impl<A> Arbitrary for Arc<A>where
A: Arbitrary,
§type Parameters = <A as Arbitrary>::Parameters
type Parameters = <A as Arbitrary>::Parameters
arbitrary_with
accepts for configuration
of the generated Strategy
. Parameters must implement Default
.§type Strategy = MapInto<<A as Arbitrary>::Strategy, Arc<A>>
type Strategy = MapInto<<A as Arbitrary>::Strategy, Arc<A>>
Strategy
used to generate values of type Self
.§fn arbitrary_with(
args: <Arc<A> as Arbitrary>::Parameters,
) -> <Arc<A> as Arbitrary>::Strategy ⓘ
fn arbitrary_with( args: <Arc<A> as Arbitrary>::Parameters, ) -> <Arc<A> as Arbitrary>::Strategy ⓘ
§impl<A> ArbitraryF1<A> for Arc<A>where
A: Debug + 'static,
impl<A> ArbitraryF1<A> for Arc<A>where
A: Debug + 'static,
§type Parameters = ()
type Parameters = ()
lift1_with
accepts for
configuration of the lifted and generated Strategy
. Parameters
must implement Default
.§fn lift1_with<S>(
base: S,
_args: <Arc<A> as ArbitraryF1<A>>::Parameters,
) -> BoxedStrategy<Arc<A>>where
S: Strategy<Value = A> + 'static,
fn lift1_with<S>(
base: S,
_args: <Arc<A> as ArbitraryF1<A>>::Parameters,
) -> BoxedStrategy<Arc<A>>where
S: Strategy<Value = A> + 'static,
1.64.0 · Source§impl<T> AsFd for Arc<T>
This impl allows implementing traits that require AsFd
on Arc.
impl<T> AsFd for Arc<T>
This impl allows implementing traits that require AsFd
on Arc.
use std::net::UdpSocket;
use std::sync::Arc;
trait MyTrait: AsFd {}
impl MyTrait for Arc<UdpSocket> {}
impl MyTrait for Box<UdpSocket> {}
Source§fn as_fd(&self) -> BorrowedFd<'_>
fn as_fd(&self) -> BorrowedFd<'_>
1.63.0 · Source§impl<T> AsRawFd for Arc<T>where
T: AsRawFd,
This impl allows implementing traits that require AsRawFd
on Arc.
impl<T> AsRawFd for Arc<T>where
T: AsRawFd,
This impl allows implementing traits that require AsRawFd
on Arc.
use std::net::UdpSocket;
use std::sync::Arc;
trait MyTrait: AsRawFd {
}
impl MyTrait for Arc<UdpSocket> {}
impl MyTrait for Box<UdpSocket> {}
Source§impl<T> BlockBodyIndicesProvider for Arc<T>
impl<T> BlockBodyIndicesProvider for Arc<T>
Source§impl<Provider, T> BlockBodyReader<Provider> for Arc<T>where
T: BlockBodyReader<Provider> + ?Sized,
impl<Provider, T> BlockBodyReader<Provider> for Arc<T>where
T: BlockBodyReader<Provider> + ?Sized,
Source§type Block = <T as BlockBodyReader<Provider>>::Block
type Block = <T as BlockBodyReader<Provider>>::Block
Source§fn read_block_bodies(
&self,
provider: &Provider,
inputs: Vec<(&<<Arc<T> as BlockBodyReader<Provider>>::Block as Block>::Header, Vec<<<<Arc<T> as BlockBodyReader<Provider>>::Block as Block>::Body as BlockBody>::Transaction>)>,
) -> Result<Vec<<<Arc<T> as BlockBodyReader<Provider>>::Block as Block>::Body>, ProviderError>
fn read_block_bodies( &self, provider: &Provider, inputs: Vec<(&<<Arc<T> as BlockBodyReader<Provider>>::Block as Block>::Header, Vec<<<<Arc<T> as BlockBodyReader<Provider>>::Block as Block>::Body as BlockBody>::Transaction>)>, ) -> Result<Vec<<<Arc<T> as BlockBodyReader<Provider>>::Block as Block>::Body>, ProviderError>
Source§impl<Provider, Body, T> BlockBodyWriter<Provider, Body> for Arc<T>where
Body: BlockBody,
T: BlockBodyWriter<Provider, Body> + ?Sized,
impl<Provider, Body, T> BlockBodyWriter<Provider, Body> for Arc<T>where
Body: BlockBody,
T: BlockBodyWriter<Provider, Body> + ?Sized,
Source§fn write_block_bodies(
&self,
provider: &Provider,
bodies: Vec<(u64, Option<Body>)>,
write_to: StorageLocation,
) -> Result<(), ProviderError>
fn write_block_bodies( &self, provider: &Provider, bodies: Vec<(u64, Option<Body>)>, write_to: StorageLocation, ) -> Result<(), ProviderError>
Source§fn remove_block_bodies_above(
&self,
provider: &Provider,
block: u64,
remove_from: StorageLocation,
) -> Result<(), ProviderError>
fn remove_block_bodies_above( &self, provider: &Provider, block: u64, remove_from: StorageLocation, ) -> Result<(), ProviderError>
§impl<T> BlockHash for Arc<T>where
T: BlockHashRef,
impl<T> BlockHash for Arc<T>where
T: BlockHashRef,
type Error = <T as BlockHashRef>::Error
§fn block_hash(
&mut self,
number: u64,
) -> Result<FixedBytes<32>, <Arc<T> as BlockHash>::Error>
fn block_hash( &mut self, number: u64, ) -> Result<FixedBytes<32>, <Arc<T> as BlockHash>::Error>
Source§impl<T> BlockHashReader for Arc<T>
impl<T> BlockHashReader for Arc<T>
Source§fn block_hash(
&self,
number: u64,
) -> Result<Option<FixedBytes<32>>, ProviderError>
fn block_hash( &self, number: u64, ) -> Result<Option<FixedBytes<32>>, ProviderError>
None
if no block with this number
exists.Source§fn convert_block_hash(
&self,
hash_or_number: HashOrNumber,
) -> Result<Option<FixedBytes<32>>, ProviderError>
fn convert_block_hash( &self, hash_or_number: HashOrNumber, ) -> Result<Option<FixedBytes<32>>, ProviderError>
None
if no block with this number
exists.Source§fn canonical_hashes_range(
&self,
start: u64,
end: u64,
) -> Result<Vec<FixedBytes<32>>, ProviderError>
fn canonical_hashes_range( &self, start: u64, end: u64, ) -> Result<Vec<FixedBytes<32>>, ProviderError>
§impl<T> BlockHashRef for Arc<T>where
T: BlockHashRef + ?Sized,
impl<T> BlockHashRef for Arc<T>where
T: BlockHashRef + ?Sized,
type Error = <T as BlockHashRef>::Error
§fn block_hash(
&self,
number: u64,
) -> Result<FixedBytes<32>, <Arc<T> as BlockHashRef>::Error>
fn block_hash( &self, number: u64, ) -> Result<FixedBytes<32>, <Arc<T> as BlockHashRef>::Error>
§impl<T> BlockHeader for Arc<T>where
T: BlockHeader + ?Sized,
impl<T> BlockHeader for Arc<T>where
T: BlockHeader + ?Sized,
§fn parent_hash(&self) -> FixedBytes<32>
fn parent_hash(&self) -> FixedBytes<32>
§fn ommers_hash(&self) -> FixedBytes<32>
fn ommers_hash(&self) -> FixedBytes<32>
§fn beneficiary(&self) -> Address
fn beneficiary(&self) -> Address
§fn state_root(&self) -> FixedBytes<32>
fn state_root(&self) -> FixedBytes<32>
§fn transactions_root(&self) -> FixedBytes<32>
fn transactions_root(&self) -> FixedBytes<32>
§fn receipts_root(&self) -> FixedBytes<32>
fn receipts_root(&self) -> FixedBytes<32>
§fn withdrawals_root(&self) -> Option<FixedBytes<32>>
fn withdrawals_root(&self) -> Option<FixedBytes<32>>
§fn logs_bloom(&self) -> Bloom
fn logs_bloom(&self) -> Bloom
§fn difficulty(&self) -> Uint<256, 4>
fn difficulty(&self) -> Uint<256, 4>
§fn mix_hash(&self) -> Option<FixedBytes<32>>
fn mix_hash(&self) -> Option<FixedBytes<32>>
§fn nonce(&self) -> Option<FixedBytes<8>>
fn nonce(&self) -> Option<FixedBytes<8>>
§fn base_fee_per_gas(&self) -> Option<u64>
fn base_fee_per_gas(&self) -> Option<u64>
§fn blob_gas_used(&self) -> Option<u64>
fn blob_gas_used(&self) -> Option<u64>
§fn excess_blob_gas(&self) -> Option<u64>
fn excess_blob_gas(&self) -> Option<u64>
§fn parent_beacon_block_root(&self) -> Option<FixedBytes<32>>
fn parent_beacon_block_root(&self) -> Option<FixedBytes<32>>
§fn requests_hash(&self) -> Option<FixedBytes<32>>
fn requests_hash(&self) -> Option<FixedBytes<32>>
§fn extra_data(&self) -> &Bytes
fn extra_data(&self) -> &Bytes
§fn blob_fee(&self, blob_params: BlobParams) -> Option<u128>
fn blob_fee(&self, blob_params: BlobParams) -> Option<u128>
§fn next_block_excess_blob_gas(&self, blob_params: BlobParams) -> Option<u64>
fn next_block_excess_blob_gas(&self, blob_params: BlobParams) -> Option<u64>
§fn next_block_blob_fee(&self, blob_params: BlobParams) -> Option<u128>
fn next_block_blob_fee(&self, blob_params: BlobParams) -> Option<u128>
§fn next_block_base_fee(&self, base_fee_params: BaseFeeParams) -> Option<u64>
fn next_block_base_fee(&self, base_fee_params: BaseFeeParams) -> Option<u64>
§fn parent_num_hash(&self) -> NumHash
fn parent_num_hash(&self) -> NumHash
§fn is_empty(&self) -> bool
fn is_empty(&self) -> bool
§fn is_zero_difficulty(&self) -> bool
fn is_zero_difficulty(&self) -> bool
§fn exceeds_allowed_future_timestamp(&self, present_timestamp: u64) -> bool
fn exceeds_allowed_future_timestamp(&self, present_timestamp: u64) -> bool
§fn is_nonce_zero(&self) -> bool
fn is_nonce_zero(&self) -> bool
Source§impl<T> BlockIdReader for Arc<T>
impl<T> BlockIdReader for Arc<T>
Source§fn convert_block_number(
&self,
num: BlockNumberOrTag,
) -> Result<Option<u64>, ProviderError>
fn convert_block_number( &self, num: BlockNumberOrTag, ) -> Result<Option<u64>, ProviderError>
BlockNumberOrTag
variants to a block number.Source§fn block_hash_for_id(
&self,
block_id: BlockId,
) -> Result<Option<FixedBytes<32>>, ProviderError>
fn block_hash_for_id( &self, block_id: BlockId, ) -> Result<Option<FixedBytes<32>>, ProviderError>
Source§fn block_number_for_id(
&self,
block_id: BlockId,
) -> Result<Option<u64>, ProviderError>
fn block_number_for_id( &self, block_id: BlockId, ) -> Result<Option<u64>, ProviderError>
Source§fn pending_block_num_hash(&self) -> Result<Option<NumHash>, ProviderError>
fn pending_block_num_hash(&self) -> Result<Option<NumHash>, ProviderError>
Source§fn safe_block_num_hash(&self) -> Result<Option<NumHash>, ProviderError>
fn safe_block_num_hash(&self) -> Result<Option<NumHash>, ProviderError>
Source§fn finalized_block_num_hash(&self) -> Result<Option<NumHash>, ProviderError>
fn finalized_block_num_hash(&self) -> Result<Option<NumHash>, ProviderError>
Source§fn finalized_block_number(&self) -> Result<Option<u64>, ProviderError>
fn finalized_block_number(&self) -> Result<Option<u64>, ProviderError>
Source§fn safe_block_hash(&self) -> Result<Option<FixedBytes<32>>, ProviderError>
fn safe_block_hash(&self) -> Result<Option<FixedBytes<32>>, ProviderError>
Source§fn finalized_block_hash(&self) -> Result<Option<FixedBytes<32>>, ProviderError>
fn finalized_block_hash(&self) -> Result<Option<FixedBytes<32>>, ProviderError>
Source§impl<T> BlockNumReader for Arc<T>
impl<T> BlockNumReader for Arc<T>
Source§fn chain_info(&self) -> Result<ChainInfo, ProviderError>
fn chain_info(&self) -> Result<ChainInfo, ProviderError>
Source§fn best_block_number(&self) -> Result<u64, ProviderError>
fn best_block_number(&self) -> Result<u64, ProviderError>
Source§fn last_block_number(&self) -> Result<u64, ProviderError>
fn last_block_number(&self) -> Result<u64, ProviderError>
Source§fn block_number(
&self,
hash: FixedBytes<32>,
) -> Result<Option<u64>, ProviderError>
fn block_number( &self, hash: FixedBytes<32>, ) -> Result<Option<u64>, ProviderError>
BlockNumber
for the given hash. Returns None
if no block with this hash exists.Source§fn convert_hash_or_number(
&self,
id: HashOrNumber,
) -> Result<Option<u64>, ProviderError>
fn convert_hash_or_number( &self, id: HashOrNumber, ) -> Result<Option<u64>, ProviderError>
BlockHashOrNumber
. Returns None
if no block with
this hash exists. If the BlockHashOrNumber
is a Number
, it is returned as is.Source§fn convert_number(
&self,
id: HashOrNumber,
) -> Result<Option<FixedBytes<32>>, ProviderError>
fn convert_number( &self, id: HashOrNumber, ) -> Result<Option<FixedBytes<32>>, ProviderError>
BlockHashOrNumber
. Returns None
if no block with this
number exists. If the BlockHashOrNumber
is a Hash
, it is returned as is.Source§impl<T> BlockReader for Arc<T>where
T: BlockReader,
impl<T> BlockReader for Arc<T>where
T: BlockReader,
Source§type Block = <T as BlockReader>::Block
type Block = <T as BlockReader>::Block
Source§fn find_block_by_hash(
&self,
hash: FixedBytes<32>,
source: BlockSource,
) -> Result<Option<<Arc<T> as BlockReader>::Block>, ProviderError>
fn find_block_by_hash( &self, hash: FixedBytes<32>, source: BlockSource, ) -> Result<Option<<Arc<T> as BlockReader>::Block>, ProviderError>
Source§fn block(
&self,
id: HashOrNumber,
) -> Result<Option<<Arc<T> as BlockReader>::Block>, ProviderError>
fn block( &self, id: HashOrNumber, ) -> Result<Option<<Arc<T> as BlockReader>::Block>, ProviderError>
Source§fn pending_block(
&self,
) -> Result<Option<SealedBlock<<<Arc<T> as BlockReader>::Block as Block>::Header, <<Arc<T> as BlockReader>::Block as Block>::Body>>, ProviderError>
fn pending_block( &self, ) -> Result<Option<SealedBlock<<<Arc<T> as BlockReader>::Block as Block>::Header, <<Arc<T> as BlockReader>::Block as Block>::Body>>, ProviderError>
Source§fn pending_block_with_senders(
&self,
) -> Result<Option<SealedBlockWithSenders<<Arc<T> as BlockReader>::Block>>, ProviderError>
fn pending_block_with_senders( &self, ) -> Result<Option<SealedBlockWithSenders<<Arc<T> as BlockReader>::Block>>, ProviderError>
Source§fn pending_block_and_receipts(
&self,
) -> Result<Option<(SealedBlock<<<Arc<T> as BlockReader>::Block as Block>::Header, <<Arc<T> as BlockReader>::Block as Block>::Body>, Vec<<Arc<T> as ReceiptProvider>::Receipt>)>, ProviderError>
fn pending_block_and_receipts( &self, ) -> Result<Option<(SealedBlock<<<Arc<T> as BlockReader>::Block as Block>::Header, <<Arc<T> as BlockReader>::Block as Block>::Body>, Vec<<Arc<T> as ReceiptProvider>::Receipt>)>, ProviderError>
Source§fn block_by_hash(
&self,
hash: FixedBytes<32>,
) -> Result<Option<<Arc<T> as BlockReader>::Block>, ProviderError>
fn block_by_hash( &self, hash: FixedBytes<32>, ) -> Result<Option<<Arc<T> as BlockReader>::Block>, ProviderError>
Source§fn block_by_number(
&self,
num: u64,
) -> Result<Option<<Arc<T> as BlockReader>::Block>, ProviderError>
fn block_by_number( &self, num: u64, ) -> Result<Option<<Arc<T> as BlockReader>::Block>, ProviderError>
Source§fn block_with_senders(
&self,
id: HashOrNumber,
transaction_kind: TransactionVariant,
) -> Result<Option<BlockWithSenders<<Arc<T> as BlockReader>::Block>>, ProviderError>
fn block_with_senders( &self, id: HashOrNumber, transaction_kind: TransactionVariant, ) -> Result<Option<BlockWithSenders<<Arc<T> as BlockReader>::Block>>, ProviderError>
Source§fn sealed_block_with_senders(
&self,
id: HashOrNumber,
transaction_kind: TransactionVariant,
) -> Result<Option<SealedBlockWithSenders<<Arc<T> as BlockReader>::Block>>, ProviderError>
fn sealed_block_with_senders( &self, id: HashOrNumber, transaction_kind: TransactionVariant, ) -> Result<Option<SealedBlockWithSenders<<Arc<T> as BlockReader>::Block>>, ProviderError>
Source§fn block_range(
&self,
range: RangeInclusive<u64>,
) -> Result<Vec<<Arc<T> as BlockReader>::Block>, ProviderError>
fn block_range( &self, range: RangeInclusive<u64>, ) -> Result<Vec<<Arc<T> as BlockReader>::Block>, ProviderError>
Source§fn block_with_senders_range(
&self,
range: RangeInclusive<u64>,
) -> Result<Vec<BlockWithSenders<<Arc<T> as BlockReader>::Block>>, ProviderError>
fn block_with_senders_range( &self, range: RangeInclusive<u64>, ) -> Result<Vec<BlockWithSenders<<Arc<T> as BlockReader>::Block>>, ProviderError>
Source§fn sealed_block_with_senders_range(
&self,
range: RangeInclusive<u64>,
) -> Result<Vec<SealedBlockWithSenders<<Arc<T> as BlockReader>::Block>>, ProviderError>
fn sealed_block_with_senders_range( &self, range: RangeInclusive<u64>, ) -> Result<Vec<SealedBlockWithSenders<<Arc<T> as BlockReader>::Block>>, ProviderError>
§impl<M, P> BoundDataProvider<M> for Arc<P>where
M: DataMarker,
P: BoundDataProvider<M> + ?Sized,
Available on target_has_atomic="ptr"
only.
impl<M, P> BoundDataProvider<M> for Arc<P>where
M: DataMarker,
P: BoundDataProvider<M> + ?Sized,
target_has_atomic="ptr"
only.§impl<T> BufferProvider for Arc<T>where
T: BufferProvider + ?Sized,
Available on target_has_atomic="ptr"
only.
impl<T> BufferProvider for Arc<T>where
T: BufferProvider + ?Sized,
target_has_atomic="ptr"
only.§fn load_buffer(
&self,
key: DataKey,
req: DataRequest<'_>,
) -> Result<DataResponse<BufferMarker>, DataError>
fn load_buffer( &self, key: DataKey, req: DataRequest<'_>, ) -> Result<DataResponse<BufferMarker>, DataError>
DataPayload
]<
[BufferMarker
]>
according to the key and request.Source§impl<T> ChangeSetReader for Arc<T>
impl<T> ChangeSetReader for Arc<T>
1.0.0 · Source§impl<T, A> Clone for Arc<T, A>
impl<T, A> Clone for Arc<T, A>
Source§fn clone(&self) -> Arc<T, A>
fn clone(&self) -> Arc<T, A>
Makes a clone of the Arc
pointer.
This creates another pointer to the same allocation, increasing the strong reference count.
§Examples
use std::sync::Arc;
let five = Arc::new(5);
let _ = Arc::clone(&five);
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more§impl<H, B, T> Consensus<H, B> for Arc<T>
impl<H, B, T> Consensus<H, B> for Arc<T>
§impl<M, P> DataProvider<M> for Arc<P>where
M: KeyedDataMarker,
P: DataProvider<M> + ?Sized,
Available on target_has_atomic="ptr"
only.
impl<M, P> DataProvider<M> for Arc<P>where
M: KeyedDataMarker,
P: DataProvider<M> + ?Sized,
target_has_atomic="ptr"
only.§impl<DB> Database for Arc<DB>where
DB: Database,
impl<DB> Database for Arc<DB>where
DB: Database,
§fn tx_mut(&self) -> Result<<Arc<DB> as Database>::TXMut, DatabaseError>
fn tx_mut(&self) -> Result<<Arc<DB> as Database>::TXMut, DatabaseError>
§impl<DB> DatabaseMetrics for Arc<DB>where
DB: DatabaseMetrics,
impl<DB> DatabaseMetrics for Arc<DB>where
DB: DatabaseMetrics,
Source§impl<T> DatabaseProviderFactory for Arc<T>
impl<T> DatabaseProviderFactory for Arc<T>
Source§type DB = <T as DatabaseProviderFactory>::DB
type DB = <T as DatabaseProviderFactory>::DB
Source§type Provider = <T as DatabaseProviderFactory>::Provider
type Provider = <T as DatabaseProviderFactory>::Provider
Source§type ProviderRW = <T as DatabaseProviderFactory>::ProviderRW
type ProviderRW = <T as DatabaseProviderFactory>::ProviderRW
Source§fn database_provider_ro(
&self,
) -> Result<<Arc<T> as DatabaseProviderFactory>::Provider, ProviderError>
fn database_provider_ro( &self, ) -> Result<<Arc<T> as DatabaseProviderFactory>::Provider, ProviderError>
Source§fn database_provider_rw(
&self,
) -> Result<<Arc<T> as DatabaseProviderFactory>::ProviderRW, ProviderError>
fn database_provider_rw( &self, ) -> Result<<Arc<T> as DatabaseProviderFactory>::ProviderRW, ProviderError>
§impl<T> DatabaseRef for Arc<T>where
T: DatabaseRef + ?Sized,
impl<T> DatabaseRef for Arc<T>where
T: DatabaseRef + ?Sized,
§type Error = <T as DatabaseRef>::Error
type Error = <T as DatabaseRef>::Error
§fn basic_ref(
&self,
address: Address,
) -> Result<Option<AccountInfo>, <Arc<T> as DatabaseRef>::Error>
fn basic_ref( &self, address: Address, ) -> Result<Option<AccountInfo>, <Arc<T> as DatabaseRef>::Error>
§fn code_by_hash_ref(
&self,
code_hash: FixedBytes<32>,
) -> Result<Bytecode, <Arc<T> as DatabaseRef>::Error>
fn code_by_hash_ref( &self, code_hash: FixedBytes<32>, ) -> Result<Bytecode, <Arc<T> as DatabaseRef>::Error>
§fn storage_ref(
&self,
address: Address,
index: Uint<256, 4>,
) -> Result<Uint<256, 4>, <Arc<T> as DatabaseRef>::Error>
fn storage_ref( &self, address: Address, index: Uint<256, 4>, ) -> Result<Uint<256, 4>, <Arc<T> as DatabaseRef>::Error>
§fn block_hash_ref(
&self,
number: u64,
) -> Result<FixedBytes<32>, <Arc<T> as DatabaseRef>::Error>
fn block_hash_ref( &self, number: u64, ) -> Result<FixedBytes<32>, <Arc<T> as DatabaseRef>::Error>
§impl<T> Decode for Arc<T>where
T: Decode,
impl<T> Decode for Arc<T>where
T: Decode,
§fn is_ssz_fixed_len() -> bool
fn is_ssz_fixed_len() -> bool
true
if this object has a fixed-length. Read more§fn ssz_fixed_len() -> usize
fn ssz_fixed_len() -> usize
1.0.0 · Source§impl<T> Default for Arc<T>where
T: Default,
Available on non-no_global_oom_handling
only.
impl<T> Default for Arc<T>where
T: Default,
no_global_oom_handling
only.Source§impl<'de, T> Deserialize<'de> for Arc<T>
Available on crate feature rc
and (crate features std
or alloc
) only.This impl requires the "rc"
Cargo feature of Serde.
impl<'de, T> Deserialize<'de> for Arc<T>
rc
and (crate features std
or alloc
) only.This impl requires the "rc"
Cargo feature of Serde.
Deserializing a data structure containing Arc
will not attempt to
deduplicate Arc
references to the same data. Every deserialized Arc
will end up with a strong count of 1.
Source§fn deserialize<D>(
deserializer: D,
) -> Result<Arc<T>, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<Arc<T>, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Source§impl<'de, T, U> DeserializeAs<'de, Arc<T>> for Arc<U>where
U: DeserializeAs<'de, T>,
Available on crate feature alloc
and target_has_atomic="ptr"
only.
impl<'de, T, U> DeserializeAs<'de, Arc<T>> for Arc<U>where
U: DeserializeAs<'de, T>,
alloc
and target_has_atomic="ptr"
only.Source§fn deserialize_as<D>(
deserializer: D,
) -> Result<Arc<T>, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize_as<D>(
deserializer: D,
) -> Result<Arc<T>, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
1.0.0 · Source§impl<T, A> Drop for Arc<T, A>
impl<T, A> Drop for Arc<T, A>
Source§fn drop(&mut self)
fn drop(&mut self)
Drops the Arc
.
This will decrement the strong reference count. If the strong reference
count reaches zero then the only other references (if any) are
Weak
, so we drop
the inner value.
§Examples
use std::sync::Arc;
struct Foo;
impl Drop for Foo {
fn drop(&mut self) {
println!("dropped!");
}
}
let foo = Arc::new(Foo);
let foo2 = Arc::clone(&foo);
drop(foo); // Doesn't print anything
drop(foo2); // Prints "dropped!"
§impl<M, P> DynamicDataProvider<M> for Arc<P>where
M: DataMarker,
P: DynamicDataProvider<M> + ?Sized,
Available on target_has_atomic="ptr"
only.
impl<M, P> DynamicDataProvider<M> for Arc<P>where
M: DataMarker,
P: DynamicDataProvider<M> + ?Sized,
target_has_atomic="ptr"
only.§impl<T> Encode for Arc<T>where
T: Encode,
impl<T> Encode for Arc<T>where
T: Encode,
§fn is_ssz_fixed_len() -> bool
fn is_ssz_fixed_len() -> bool
true
if this object has a fixed-length. Read more§fn ssz_fixed_len() -> usize
fn ssz_fixed_len() -> usize
§fn ssz_append(&self, buf: &mut Vec<u8>)
fn ssz_append(&self, buf: &mut Vec<u8>)
§fn ssz_bytes_len(&self) -> usize
fn ssz_bytes_len(&self) -> usize
self
is serialized. Read more1.52.0 · Source§impl<T> Error for Arc<T>
impl<T> Error for Arc<T>
Source§fn description(&self) -> &str
fn description(&self) -> &str
Source§fn cause(&self) -> Option<&dyn Error>
fn cause(&self) -> Option<&dyn Error>
§impl<T> EthChainSpec for Arc<T>
impl<T> EthChainSpec for Arc<T>
§fn base_fee_params_at_block(&self, block_number: u64) -> BaseFeeParams
fn base_fee_params_at_block(&self, block_number: u64) -> BaseFeeParams
BaseFeeParams
] for the chain at the given block.§fn base_fee_params_at_timestamp(&self, timestamp: u64) -> BaseFeeParams
fn base_fee_params_at_timestamp(&self, timestamp: u64) -> BaseFeeParams
BaseFeeParams
] for the chain at the given timestamp.§fn deposit_contract(&self) -> Option<&DepositContract>
fn deposit_contract(&self) -> Option<&DepositContract>
§fn genesis_hash(&self) -> FixedBytes<32>
fn genesis_hash(&self) -> FixedBytes<32>
§fn prune_delete_limit(&self) -> usize
fn prune_delete_limit(&self) -> usize
§fn display_hardforks(&self) -> Box<dyn Display>
fn display_hardforks(&self) -> Box<dyn Display>
§fn genesis_header(&self) -> &<Arc<T> as EthChainSpec>::Header ⓘ
fn genesis_header(&self) -> &<Arc<T> as EthChainSpec>::Header ⓘ
§fn is_optimism(&self) -> bool
fn is_optimism(&self) -> bool
true
if this chain contains Optimism configuration.§fn is_ethereum(&self) -> bool
fn is_ethereum(&self) -> bool
true
if this chain contains Ethereum configuration.§impl<T> EthereumHardforks for Arc<T>
impl<T> EthereumHardforks for Arc<T>
§fn ethereum_fork_activation(&self, fork: EthereumHardfork) -> ForkCondition
fn ethereum_fork_activation(&self, fork: EthereumHardfork) -> ForkCondition
ForkCondition
] by an [EthereumHardfork
]. If fork
is not present, returns
[ForkCondition::Never
].§fn is_ethereum_fork_active_at_timestamp(
&self,
fork: EthereumHardfork,
timestamp: u64,
) -> bool
fn is_ethereum_fork_active_at_timestamp( &self, fork: EthereumHardfork, timestamp: u64, ) -> bool
EthereumHardfork
] is active at a given timestamp.§fn is_ethereum_fork_active_at_block(
&self,
fork: EthereumHardfork,
block_number: u64,
) -> bool
fn is_ethereum_fork_active_at_block( &self, fork: EthereumHardfork, block_number: u64, ) -> bool
EthereumHardfork
] is active at a given block number.§fn is_shanghai_active_at_timestamp(&self, timestamp: u64) -> bool
fn is_shanghai_active_at_timestamp(&self, timestamp: u64) -> bool
EthereumHardfork::Shanghai
] is active at a given
timestamp.§fn is_cancun_active_at_timestamp(&self, timestamp: u64) -> bool
fn is_cancun_active_at_timestamp(&self, timestamp: u64) -> bool
EthereumHardfork::Cancun
] is active at a given timestamp.§fn is_prague_active_at_timestamp(&self, timestamp: u64) -> bool
fn is_prague_active_at_timestamp(&self, timestamp: u64) -> bool
EthereumHardfork::Prague
] is active at a given timestamp.§fn is_osaka_active_at_timestamp(&self, timestamp: u64) -> bool
fn is_osaka_active_at_timestamp(&self, timestamp: u64) -> bool
EthereumHardfork::Osaka
] is active at a given timestamp.§fn is_byzantium_active_at_block(&self, block_number: u64) -> bool
fn is_byzantium_active_at_block(&self, block_number: u64) -> bool
EthereumHardfork::Byzantium
] is active at a given block
number.§fn is_spurious_dragon_active_at_block(&self, block_number: u64) -> bool
fn is_spurious_dragon_active_at_block(&self, block_number: u64) -> bool
EthereumHardfork::SpuriousDragon
] is active at a given
block number.§fn is_homestead_active_at_block(&self, block_number: u64) -> bool
fn is_homestead_active_at_block(&self, block_number: u64) -> bool
EthereumHardfork::Homestead
] is active at a given block
number.§fn is_london_active_at_block(&self, block_number: u64) -> bool
fn is_london_active_at_block(&self, block_number: u64) -> bool
EthereumHardfork::London
] is active at a given block
number.§fn is_constantinople_active_at_block(&self, block_number: u64) -> bool
fn is_constantinople_active_at_block(&self, block_number: u64) -> bool
EthereumHardfork::Constantinople
] is active at a given
block number.§fn is_paris_active_at_block(&self, block_number: u64) -> Option<bool>
fn is_paris_active_at_block(&self, block_number: u64) -> Option<bool>
§fn get_final_paris_total_difficulty(&self) -> Option<Uint<256, 4>>
fn get_final_paris_total_difficulty(&self) -> Option<Uint<256, 4>>
1.21.0 · Source§impl<T, A> From<Box<T, A>> for Arc<T, A>
Available on non-no_global_oom_handling
only.
impl<T, A> From<Box<T, A>> for Arc<T, A>
no_global_oom_handling
only.§impl<N, T> FullConsensus<N> for Arc<T>
impl<N, T> FullConsensus<N> for Arc<T>
§fn validate_block_post_execution(
&self,
block: &BlockWithSenders<<N as NodePrimitives>::Block>,
input: PostExecutionInput<'_, <N as NodePrimitives>::Receipt>,
) -> Result<(), ConsensusError>
fn validate_block_post_execution( &self, block: &BlockWithSenders<<N as NodePrimitives>::Block>, input: PostExecutionInput<'_, <N as NodePrimitives>::Receipt>, ) -> Result<(), ConsensusError>
§impl<T> Hardforks for Arc<T>
impl<T> Hardforks for Arc<T>
§fn fork<H>(&self, fork: H) -> ForkConditionwhere
H: Hardfork,
fn fork<H>(&self, fork: H) -> ForkConditionwhere
H: Hardfork,
ForkCondition
] from fork
. If fork
is not present, returns
[ForkCondition::Never
].§fn forks_iter(
&self,
) -> impl Iterator<Item = (&(dyn Hardfork + 'static), ForkCondition)>
fn forks_iter( &self, ) -> impl Iterator<Item = (&(dyn Hardfork + 'static), ForkCondition)>
§fn is_fork_active_at_timestamp<H>(&self, fork: H, timestamp: u64) -> boolwhere
H: Hardfork,
fn is_fork_active_at_timestamp<H>(&self, fork: H, timestamp: u64) -> boolwhere
H: Hardfork,
§fn is_fork_active_at_block<H>(&self, fork: H, block_number: u64) -> boolwhere
H: Hardfork,
fn is_fork_active_at_block<H>(&self, fork: H, block_number: u64) -> boolwhere
H: Hardfork,
§fn fork_id(&self, head: &Head) -> ForkId
fn fork_id(&self, head: &Head) -> ForkId
ForkId
] for the given [Head
] following eip-6122 spec§fn latest_fork_id(&self) -> ForkId
fn latest_fork_id(&self) -> ForkId
ForkId
] for the last fork.§fn fork_filter(&self, head: Head) -> ForkFilter
fn fork_filter(&self, head: Head) -> ForkFilter
ForkFilter
] for the block described by [Head].Source§impl<T> HashedPostStateProvider for Arc<T>
impl<T> HashedPostStateProvider for Arc<T>
Source§fn hashed_post_state(&self, bundle_state: &BundleState) -> HashedPostState
fn hashed_post_state(&self, bundle_state: &BundleState) -> HashedPostState
HashedPostState
of the provided BundleState
.Source§impl<T> HashingWriter for Arc<T>
impl<T> HashingWriter for Arc<T>
Source§fn unwind_account_hashing<'a>(
&self,
changesets: impl Iterator<Item = &'a (u64, AccountBeforeTx)>,
) -> Result<BTreeMap<FixedBytes<32>, Option<Account>>, ProviderError>
fn unwind_account_hashing<'a>( &self, changesets: impl Iterator<Item = &'a (u64, AccountBeforeTx)>, ) -> Result<BTreeMap<FixedBytes<32>, Option<Account>>, ProviderError>
Source§fn unwind_account_hashing_range(
&self,
range: impl RangeBounds<u64>,
) -> Result<BTreeMap<FixedBytes<32>, Option<Account>>, ProviderError>
fn unwind_account_hashing_range( &self, range: impl RangeBounds<u64>, ) -> Result<BTreeMap<FixedBytes<32>, Option<Account>>, ProviderError>
Source§fn insert_account_for_hashing(
&self,
accounts: impl IntoIterator<Item = (Address, Option<Account>)>,
) -> Result<BTreeMap<FixedBytes<32>, Option<Account>>, ProviderError>
fn insert_account_for_hashing( &self, accounts: impl IntoIterator<Item = (Address, Option<Account>)>, ) -> Result<BTreeMap<FixedBytes<32>, Option<Account>>, ProviderError>
Source§fn unwind_storage_hashing(
&self,
changesets: impl Iterator<Item = (BlockNumberAddress, StorageEntry)>,
) -> Result<HashMap<FixedBytes<32>, BTreeSet<FixedBytes<32>>, RandomState>, ProviderError>
fn unwind_storage_hashing( &self, changesets: impl Iterator<Item = (BlockNumberAddress, StorageEntry)>, ) -> Result<HashMap<FixedBytes<32>, BTreeSet<FixedBytes<32>>, RandomState>, ProviderError>
Source§fn unwind_storage_hashing_range(
&self,
range: impl RangeBounds<BlockNumberAddress>,
) -> Result<HashMap<FixedBytes<32>, BTreeSet<FixedBytes<32>>, RandomState>, ProviderError>
fn unwind_storage_hashing_range( &self, range: impl RangeBounds<BlockNumberAddress>, ) -> Result<HashMap<FixedBytes<32>, BTreeSet<FixedBytes<32>>, RandomState>, ProviderError>
Source§fn insert_storage_for_hashing(
&self,
storages: impl IntoIterator<Item = (Address, impl IntoIterator<Item = StorageEntry>)>,
) -> Result<HashMap<FixedBytes<32>, BTreeSet<FixedBytes<32>>, RandomState>, ProviderError>
fn insert_storage_for_hashing( &self, storages: impl IntoIterator<Item = (Address, impl IntoIterator<Item = StorageEntry>)>, ) -> Result<HashMap<FixedBytes<32>, BTreeSet<FixedBytes<32>>, RandomState>, ProviderError>
Source§fn insert_hashes(
&self,
range: RangeInclusive<u64>,
end_block_hash: FixedBytes<32>,
expected_state_root: FixedBytes<32>,
) -> Result<(), ProviderError>
fn insert_hashes( &self, range: RangeInclusive<u64>, end_block_hash: FixedBytes<32>, expected_state_root: FixedBytes<32>, ) -> Result<(), ProviderError>
Source§impl<T> HeaderProvider for Arc<T>
impl<T> HeaderProvider for Arc<T>
Source§type Header = <T as HeaderProvider>::Header
type Header = <T as HeaderProvider>::Header
Source§fn is_known(&self, block_hash: &FixedBytes<32>) -> Result<bool, ProviderError>
fn is_known(&self, block_hash: &FixedBytes<32>) -> Result<bool, ProviderError>
Source§fn header(
&self,
block_hash: &FixedBytes<32>,
) -> Result<Option<<Arc<T> as HeaderProvider>::Header>, ProviderError>
fn header( &self, block_hash: &FixedBytes<32>, ) -> Result<Option<<Arc<T> as HeaderProvider>::Header>, ProviderError>
Source§fn sealed_header_by_hash(
&self,
block_hash: FixedBytes<32>,
) -> Result<Option<SealedHeader<<Arc<T> as HeaderProvider>::Header>>, ProviderError>
fn sealed_header_by_hash( &self, block_hash: FixedBytes<32>, ) -> Result<Option<SealedHeader<<Arc<T> as HeaderProvider>::Header>>, ProviderError>
Source§fn header_by_number(
&self,
num: u64,
) -> Result<Option<<Arc<T> as HeaderProvider>::Header>, ProviderError>
fn header_by_number( &self, num: u64, ) -> Result<Option<<Arc<T> as HeaderProvider>::Header>, ProviderError>
Source§fn header_by_hash_or_number(
&self,
hash_or_num: HashOrNumber,
) -> Result<Option<<Arc<T> as HeaderProvider>::Header>, ProviderError>
fn header_by_hash_or_number( &self, hash_or_num: HashOrNumber, ) -> Result<Option<<Arc<T> as HeaderProvider>::Header>, ProviderError>
Source§fn header_td(
&self,
hash: &FixedBytes<32>,
) -> Result<Option<Uint<256, 4>>, ProviderError>
fn header_td( &self, hash: &FixedBytes<32>, ) -> Result<Option<Uint<256, 4>>, ProviderError>
Source§fn header_td_by_number(
&self,
number: u64,
) -> Result<Option<Uint<256, 4>>, ProviderError>
fn header_td_by_number( &self, number: u64, ) -> Result<Option<Uint<256, 4>>, ProviderError>
Source§fn headers_range(
&self,
range: impl RangeBounds<u64>,
) -> Result<Vec<<Arc<T> as HeaderProvider>::Header>, ProviderError>
fn headers_range( &self, range: impl RangeBounds<u64>, ) -> Result<Vec<<Arc<T> as HeaderProvider>::Header>, ProviderError>
Source§fn sealed_header(
&self,
number: u64,
) -> Result<Option<SealedHeader<<Arc<T> as HeaderProvider>::Header>>, ProviderError>
fn sealed_header( &self, number: u64, ) -> Result<Option<SealedHeader<<Arc<T> as HeaderProvider>::Header>>, ProviderError>
Source§fn sealed_headers_range(
&self,
range: impl RangeBounds<u64>,
) -> Result<Vec<SealedHeader<<Arc<T> as HeaderProvider>::Header>>, ProviderError>
fn sealed_headers_range( &self, range: impl RangeBounds<u64>, ) -> Result<Vec<SealedHeader<<Arc<T> as HeaderProvider>::Header>>, ProviderError>
Source§fn sealed_headers_while(
&self,
range: impl RangeBounds<u64>,
predicate: impl FnMut(&SealedHeader<<Arc<T> as HeaderProvider>::Header>) -> bool,
) -> Result<Vec<SealedHeader<<Arc<T> as HeaderProvider>::Header>>, ProviderError>
fn sealed_headers_while( &self, range: impl RangeBounds<u64>, predicate: impl FnMut(&SealedHeader<<Arc<T> as HeaderProvider>::Header>) -> bool, ) -> Result<Vec<SealedHeader<<Arc<T> as HeaderProvider>::Header>>, ProviderError>
predicate
returns true
or the range is exhausted.§impl<H, T> HeaderValidator<H> for Arc<T>
impl<H, T> HeaderValidator<H> for Arc<T>
§fn validate_header(
&self,
header: &SealedHeader<H>,
) -> Result<(), ConsensusError>
fn validate_header( &self, header: &SealedHeader<H>, ) -> Result<(), ConsensusError>
§fn validate_header_against_parent(
&self,
header: &SealedHeader<H>,
parent: &SealedHeader<H>,
) -> Result<(), ConsensusError>
fn validate_header_against_parent( &self, header: &SealedHeader<H>, parent: &SealedHeader<H>, ) -> Result<(), ConsensusError>
Source§impl<T> HistoryWriter for Arc<T>
impl<T> HistoryWriter for Arc<T>
Source§fn unwind_account_history_indices<'a>(
&self,
changesets: impl Iterator<Item = &'a (u64, AccountBeforeTx)>,
) -> Result<usize, ProviderError>
fn unwind_account_history_indices<'a>( &self, changesets: impl Iterator<Item = &'a (u64, AccountBeforeTx)>, ) -> Result<usize, ProviderError>
Source§fn unwind_account_history_indices_range(
&self,
range: impl RangeBounds<u64>,
) -> Result<usize, ProviderError>
fn unwind_account_history_indices_range( &self, range: impl RangeBounds<u64>, ) -> Result<usize, ProviderError>
Source§fn insert_account_history_index(
&self,
index_updates: impl IntoIterator<Item = (Address, impl IntoIterator<Item = u64>)>,
) -> Result<(), ProviderError>
fn insert_account_history_index( &self, index_updates: impl IntoIterator<Item = (Address, impl IntoIterator<Item = u64>)>, ) -> Result<(), ProviderError>
Source§fn unwind_storage_history_indices(
&self,
changesets: impl Iterator<Item = (BlockNumberAddress, StorageEntry)>,
) -> Result<usize, ProviderError>
fn unwind_storage_history_indices( &self, changesets: impl Iterator<Item = (BlockNumberAddress, StorageEntry)>, ) -> Result<usize, ProviderError>
Source§fn unwind_storage_history_indices_range(
&self,
range: impl RangeBounds<BlockNumberAddress>,
) -> Result<usize, ProviderError>
fn unwind_storage_history_indices_range( &self, range: impl RangeBounds<BlockNumberAddress>, ) -> Result<usize, ProviderError>
Source§fn insert_storage_history_index(
&self,
storage_transitions: impl IntoIterator<Item = ((Address, FixedBytes<32>), impl IntoIterator<Item = u64>)>,
) -> Result<(), ProviderError>
fn insert_storage_history_index( &self, storage_transitions: impl IntoIterator<Item = ((Address, FixedBytes<32>), impl IntoIterator<Item = u64>)>, ) -> Result<(), ProviderError>
Source§fn update_history_indices(
&self,
range: RangeInclusive<u64>,
) -> Result<(), ProviderError>
fn update_history_indices( &self, range: RangeInclusive<u64>, ) -> Result<(), ProviderError>
§impl<'a, W> MakeWriter<'a> for Arc<W>
impl<'a, W> MakeWriter<'a> for Arc<W>
§type Writer = &'a W
type Writer = &'a W
io::Write
implementation returned by make_writer
.§fn make_writer(&'a self) -> <Arc<W> as MakeWriter<'a>>::Writer ⓘ
fn make_writer(&'a self) -> <Arc<W> as MakeWriter<'a>>::Writer ⓘ
§fn make_writer_for(&'a self, meta: &Metadata<'_>) -> Self::Writer
fn make_writer_for(&'a self, meta: &Metadata<'_>) -> Self::Writer
§impl<N, T> NetworkWallet<N> for Arc<T>
impl<N, T> NetworkWallet<N> for Arc<T>
§fn default_signer_address(&self) -> Address
fn default_signer_address(&self) -> Address
NetworkWallet::sign_transaction_from
] when no specific signer is
specified.§fn has_signer_for(&self, address: &Address) -> bool
fn has_signer_for(&self, address: &Address) -> bool
§fn signer_addresses(&self) -> impl Iterator<Item = Address>
fn signer_addresses(&self) -> impl Iterator<Item = Address>
§fn sign_transaction_from(
&self,
sender: Address,
tx: <N as Network>::UnsignedTx,
) -> impl Send + Future<Output = Result<<N as Network>::TxEnvelope, Error>>
fn sign_transaction_from( &self, sender: Address, tx: <N as Network>::UnsignedTx, ) -> impl Send + Future<Output = Result<<N as Network>::TxEnvelope, Error>>
§fn sign_transaction(
&self,
tx: <N as Network>::UnsignedTx,
) -> impl Send + Future<Output = Result<<N as Network>::TxEnvelope, Error>>
fn sign_transaction( &self, tx: <N as Network>::UnsignedTx, ) -> impl Send + Future<Output = Result<<N as Network>::TxEnvelope, Error>>
§fn sign_request(
&self,
request: <N as Network>::TransactionRequest,
) -> impl Send + Future<Output = Result<<N as Network>::TxEnvelope, Error>>
fn sign_request( &self, request: <N as Network>::TransactionRequest, ) -> impl Send + Future<Output = Result<<N as Network>::TxEnvelope, Error>>
from
field.Source§impl<T> NodePrimitivesProvider for Arc<T>where
T: NodePrimitivesProvider + ?Sized,
impl<T> NodePrimitivesProvider for Arc<T>where
T: NodePrimitivesProvider + ?Sized,
Source§type Primitives = <T as NodePrimitivesProvider>::Primitives
type Primitives = <T as NodePrimitivesProvider>::Primitives
Source§impl<T> OmmersProvider for Arc<T>where
T: OmmersProvider,
impl<T> OmmersProvider for Arc<T>where
T: OmmersProvider,
1.0.0 · Source§impl<T, A> Ord for Arc<T, A>
impl<T, A> Ord for Arc<T, A>
Source§fn cmp(&self, other: &Arc<T, A>) -> Ordering
fn cmp(&self, other: &Arc<T, A>) -> Ordering
Comparison for two Arc
s.
The two are compared by calling cmp()
on their inner values.
§Examples
use std::sync::Arc;
use std::cmp::Ordering;
let five = Arc::new(5);
assert_eq!(Ordering::Less, five.cmp(&Arc::new(6)));
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.0.0 · Source§impl<T, A> PartialEq for Arc<T, A>
impl<T, A> PartialEq for Arc<T, A>
Source§fn eq(&self, other: &Arc<T, A>) -> bool
fn eq(&self, other: &Arc<T, A>) -> bool
Equality for two Arc
s.
Two Arc
s are equal if their inner values are equal, even if they are
stored in different allocation.
If T
also implements Eq
(implying reflexivity of equality),
two Arc
s that point to the same allocation are always equal.
§Examples
use std::sync::Arc;
let five = Arc::new(5);
assert!(five == Arc::new(5));
Source§fn ne(&self, other: &Arc<T, A>) -> bool
fn ne(&self, other: &Arc<T, A>) -> bool
Inequality for two Arc
s.
Two Arc
s are not equal if their inner values are not equal.
If T
also implements Eq
(implying reflexivity of equality),
two Arc
s that point to the same value are always equal.
§Examples
use std::sync::Arc;
let five = Arc::new(5);
assert!(five != Arc::new(6));
1.0.0 · Source§impl<T, A> PartialOrd for Arc<T, A>
impl<T, A> PartialOrd for Arc<T, A>
Source§fn partial_cmp(&self, other: &Arc<T, A>) -> Option<Ordering>
fn partial_cmp(&self, other: &Arc<T, A>) -> Option<Ordering>
Partial comparison for two Arc
s.
The two are compared by calling partial_cmp()
on their inner values.
§Examples
use std::sync::Arc;
use std::cmp::Ordering;
let five = Arc::new(5);
assert_eq!(Some(Ordering::Less), five.partial_cmp(&Arc::new(6)));
Source§fn lt(&self, other: &Arc<T, A>) -> bool
fn lt(&self, other: &Arc<T, A>) -> bool
Less-than comparison for two Arc
s.
The two are compared by calling <
on their inner values.
§Examples
use std::sync::Arc;
let five = Arc::new(5);
assert!(five < Arc::new(6));
Source§fn le(&self, other: &Arc<T, A>) -> bool
fn le(&self, other: &Arc<T, A>) -> bool
‘Less than or equal to’ comparison for two Arc
s.
The two are compared by calling <=
on their inner values.
§Examples
use std::sync::Arc;
let five = Arc::new(5);
assert!(five <= Arc::new(5));
Source§impl<T> PruneCheckpointReader for Arc<T>
impl<T> PruneCheckpointReader for Arc<T>
Source§fn get_prune_checkpoint(
&self,
segment: PruneSegment,
) -> Result<Option<PruneCheckpoint>, ProviderError>
fn get_prune_checkpoint( &self, segment: PruneSegment, ) -> Result<Option<PruneCheckpoint>, ProviderError>
Source§fn get_prune_checkpoints(
&self,
) -> Result<Vec<(PruneSegment, PruneCheckpoint)>, ProviderError>
fn get_prune_checkpoints( &self, ) -> Result<Vec<(PruneSegment, PruneCheckpoint)>, ProviderError>
Source§impl<T> PruneCheckpointWriter for Arc<T>
impl<T> PruneCheckpointWriter for Arc<T>
Source§fn save_prune_checkpoint(
&self,
segment: PruneSegment,
checkpoint: PruneCheckpoint,
) -> Result<(), ProviderError>
fn save_prune_checkpoint( &self, segment: PruneSegment, checkpoint: PruneCheckpoint, ) -> Result<(), ProviderError>
Source§impl<T> ReceiptProvider for Arc<T>
impl<T> ReceiptProvider for Arc<T>
Source§type Receipt = <T as ReceiptProvider>::Receipt
type Receipt = <T as ReceiptProvider>::Receipt
Source§fn receipt(
&self,
id: u64,
) -> Result<Option<<Arc<T> as ReceiptProvider>::Receipt>, ProviderError>
fn receipt( &self, id: u64, ) -> Result<Option<<Arc<T> as ReceiptProvider>::Receipt>, ProviderError>
Source§fn receipt_by_hash(
&self,
hash: FixedBytes<32>,
) -> Result<Option<<Arc<T> as ReceiptProvider>::Receipt>, ProviderError>
fn receipt_by_hash( &self, hash: FixedBytes<32>, ) -> Result<Option<<Arc<T> as ReceiptProvider>::Receipt>, ProviderError>
Source§fn receipts_by_block(
&self,
block: HashOrNumber,
) -> Result<Option<Vec<<Arc<T> as ReceiptProvider>::Receipt>>, ProviderError>
fn receipts_by_block( &self, block: HashOrNumber, ) -> Result<Option<Vec<<Arc<T> as ReceiptProvider>::Receipt>>, ProviderError>
Source§fn receipts_by_tx_range(
&self,
range: impl RangeBounds<u64>,
) -> Result<Vec<<Arc<T> as ReceiptProvider>::Receipt>, ProviderError>
fn receipts_by_tx_range( &self, range: impl RangeBounds<u64>, ) -> Result<Vec<<Arc<T> as ReceiptProvider>::Receipt>, ProviderError>
§impl<T> Recorder for Arc<T>where
T: Recorder + ?Sized,
impl<T> Recorder for Arc<T>where
T: Recorder + ?Sized,
§fn describe_counter(
&self,
key: KeyName,
unit: Option<Unit>,
description: Cow<'static, str>,
)
fn describe_counter( &self, key: KeyName, unit: Option<Unit>, description: Cow<'static, str>, )
§fn describe_gauge(
&self,
key: KeyName,
unit: Option<Unit>,
description: Cow<'static, str>,
)
fn describe_gauge( &self, key: KeyName, unit: Option<Unit>, description: Cow<'static, str>, )
§fn describe_histogram(
&self,
key: KeyName,
unit: Option<Unit>,
description: Cow<'static, str>,
)
fn describe_histogram( &self, key: KeyName, unit: Option<Unit>, description: Cow<'static, str>, )
§fn register_counter(&self, key: &Key, metadata: &Metadata<'_>) -> Counter
fn register_counter(&self, key: &Key, metadata: &Metadata<'_>) -> Counter
§fn register_gauge(&self, key: &Key, metadata: &Metadata<'_>) -> Gauge
fn register_gauge(&self, key: &Key, metadata: &Metadata<'_>) -> Gauge
§fn register_histogram(&self, key: &Key, metadata: &Metadata<'_>) -> Histogram
fn register_histogram(&self, key: &Key, metadata: &Metadata<'_>) -> Histogram
Source§impl<T> Serialize for Arc<T>
Available on crate feature rc
and (crate features std
or alloc
) only.This impl requires the "rc"
Cargo feature of Serde.
impl<T> Serialize for Arc<T>
rc
and (crate features std
or alloc
) only.This impl requires the "rc"
Cargo feature of Serde.
Serializing a data structure containing Arc
will serialize a copy of
the contents of the Arc
each time the Arc
is referenced within the
data structure. Serialization will not attempt to deduplicate these
repeated data.
Source§fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
Source§impl<T, U> SerializeAs<Arc<T>> for Arc<U>where
U: SerializeAs<T>,
Available on crate feature alloc
and target_has_atomic="ptr"
only.
impl<T, U> SerializeAs<Arc<T>> for Arc<U>where
U: SerializeAs<T>,
alloc
and target_has_atomic="ptr"
only.Source§fn serialize_as<S>(
source: &Arc<T>,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize_as<S>(
source: &Arc<T>,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
§impl<T> SignedTransaction for Arc<T>
impl<T> SignedTransaction for Arc<T>
§fn tx_hash(&self) -> &FixedBytes<32>
fn tx_hash(&self) -> &FixedBytes<32>
§fn signature(&self) -> &PrimitiveSignature
fn signature(&self) -> &PrimitiveSignature
§fn is_broadcastable_in_full(&self) -> bool
fn is_broadcastable_in_full(&self) -> bool
§fn recover_signer(&self) -> Option<Address>
fn recover_signer(&self) -> Option<Address>
§fn recover_signer_unchecked(&self) -> Option<Address>
fn recover_signer_unchecked(&self) -> Option<Address>
s
value. Read more§fn recover_signer_unchecked_with_buf(
&self,
buf: &mut Vec<u8>,
) -> Option<Address>
fn recover_signer_unchecked_with_buf( &self, buf: &mut Vec<u8>, ) -> Option<Address>
Self::recover_signer_unchecked
] but receives a buffer to operate on. This is used
during batch recovery to avoid allocating a new buffer for each transaction.§fn recalculate_hash(&self) -> FixedBytes<32>
fn recalculate_hash(&self) -> FixedBytes<32>
§impl<Sig, U> SignerSync<Sig> for Arc<U>where
U: SignerSync<Sig> + ?Sized,
impl<Sig, U> SignerSync<Sig> for Arc<U>where
U: SignerSync<Sig> + ?Sized,
§fn sign_hash_sync(&self, hash: &FixedBytes<32>) -> Result<Sig, Error>
fn sign_hash_sync(&self, hash: &FixedBytes<32>) -> Result<Sig, Error>
§fn sign_message_sync(&self, message: &[u8]) -> Result<Sig, Error>
fn sign_message_sync(&self, message: &[u8]) -> Result<Sig, Error>
§fn chain_id_sync(&self) -> Option<u64>
fn chain_id_sync(&self) -> Option<u64>
Source§impl<T> StageCheckpointReader for Arc<T>
impl<T> StageCheckpointReader for Arc<T>
Source§impl<T> StageCheckpointWriter for Arc<T>
impl<T> StageCheckpointWriter for Arc<T>
§impl<T> State for Arc<T>where
T: StateRef,
impl<T> State for Arc<T>where
T: StateRef,
Source§impl<T> StateProofProvider for Arc<T>
impl<T> StateProofProvider for Arc<T>
Source§fn proof(
&self,
input: TrieInput,
address: Address,
slots: &[FixedBytes<32>],
) -> Result<AccountProof, ProviderError>
fn proof( &self, input: TrieInput, address: Address, slots: &[FixedBytes<32>], ) -> Result<AccountProof, ProviderError>
HashedPostState
on top of the current state.Source§fn multiproof(
&self,
input: TrieInput,
targets: HashMap<FixedBytes<32>, HashSet<FixedBytes<32>, FbBuildHasher<32>>, FbBuildHasher<32>>,
) -> Result<MultiProof, ProviderError>
fn multiproof( &self, input: TrieInput, targets: HashMap<FixedBytes<32>, HashSet<FixedBytes<32>, FbBuildHasher<32>>, FbBuildHasher<32>>, ) -> Result<MultiProof, ProviderError>
MultiProof
] for target hashed account and corresponding
hashed storage slot keys.Source§fn witness(
&self,
input: TrieInput,
target: HashedPostState,
) -> Result<HashMap<FixedBytes<32>, Bytes, FbBuildHasher<32>>, ProviderError>
fn witness( &self, input: TrieInput, target: HashedPostState, ) -> Result<HashMap<FixedBytes<32>, Bytes, FbBuildHasher<32>>, ProviderError>
Source§impl<T> StateProvider for Arc<T>where
T: StateProvider + ?Sized,
Arc<T>: BlockHashReader + AccountReader + StateRootProvider + StorageRootProvider + StateProofProvider + HashedPostStateProvider + Send + Sync,
impl<T> StateProvider for Arc<T>where
T: StateProvider + ?Sized,
Arc<T>: BlockHashReader + AccountReader + StateRootProvider + StorageRootProvider + StateProofProvider + HashedPostStateProvider + Send + Sync,
Source§fn storage(
&self,
account: Address,
storage_key: FixedBytes<32>,
) -> Result<Option<Uint<256, 4>>, ProviderError>
fn storage( &self, account: Address, storage_key: FixedBytes<32>, ) -> Result<Option<Uint<256, 4>>, ProviderError>
Source§fn bytecode_by_hash(
&self,
code_hash: &FixedBytes<32>,
) -> Result<Option<Bytecode>, ProviderError>
fn bytecode_by_hash( &self, code_hash: &FixedBytes<32>, ) -> Result<Option<Bytecode>, ProviderError>
Source§fn account_code(
&self,
addr: &Address,
) -> Result<Option<Bytecode>, ProviderError>
fn account_code( &self, addr: &Address, ) -> Result<Option<Bytecode>, ProviderError>
Source§impl<T> StateProviderFactory for Arc<T>
impl<T> StateProviderFactory for Arc<T>
Source§fn latest(&self) -> Result<Box<dyn StateProvider>, ProviderError>
fn latest(&self) -> Result<Box<dyn StateProvider>, ProviderError>
Source§fn state_by_block_id(
&self,
block_id: BlockId,
) -> Result<Box<dyn StateProvider>, ProviderError>
fn state_by_block_id( &self, block_id: BlockId, ) -> Result<Box<dyn StateProvider>, ProviderError>
Source§fn state_by_block_number_or_tag(
&self,
number_or_tag: BlockNumberOrTag,
) -> Result<Box<dyn StateProvider>, ProviderError>
fn state_by_block_number_or_tag( &self, number_or_tag: BlockNumberOrTag, ) -> Result<Box<dyn StateProvider>, ProviderError>
Source§fn history_by_block_number(
&self,
block: u64,
) -> Result<Box<dyn StateProvider>, ProviderError>
fn history_by_block_number( &self, block: u64, ) -> Result<Box<dyn StateProvider>, ProviderError>
Source§fn history_by_block_hash(
&self,
block: FixedBytes<32>,
) -> Result<Box<dyn StateProvider>, ProviderError>
fn history_by_block_hash( &self, block: FixedBytes<32>, ) -> Result<Box<dyn StateProvider>, ProviderError>
Source§fn state_by_block_hash(
&self,
block: FixedBytes<32>,
) -> Result<Box<dyn StateProvider>, ProviderError>
fn state_by_block_hash( &self, block: FixedBytes<32>, ) -> Result<Box<dyn StateProvider>, ProviderError>
Source§fn pending(&self) -> Result<Box<dyn StateProvider>, ProviderError>
fn pending(&self) -> Result<Box<dyn StateProvider>, ProviderError>
Source§fn pending_state_by_hash(
&self,
block_hash: FixedBytes<32>,
) -> Result<Option<Box<dyn StateProvider>>, ProviderError>
fn pending_state_by_hash( &self, block_hash: FixedBytes<32>, ) -> Result<Option<Box<dyn StateProvider>>, ProviderError>
§impl<T> StateRef for Arc<T>
impl<T> StateRef for Arc<T>
Source§impl<T> StateRootProvider for Arc<T>
impl<T> StateRootProvider for Arc<T>
Source§fn state_root(
&self,
hashed_state: HashedPostState,
) -> Result<FixedBytes<32>, ProviderError>
fn state_root( &self, hashed_state: HashedPostState, ) -> Result<FixedBytes<32>, ProviderError>
BundleState
on top of the current state. Read moreSource§fn state_root_from_nodes(
&self,
input: TrieInput,
) -> Result<FixedBytes<32>, ProviderError>
fn state_root_from_nodes( &self, input: TrieInput, ) -> Result<FixedBytes<32>, ProviderError>
HashedPostState
on top of the current state but re-uses the
intermediate nodes to speed up the computation. It’s up to the caller to construct the
prefix sets and inform the provider of the trie paths that have changes.Source§fn state_root_with_updates(
&self,
hashed_state: HashedPostState,
) -> Result<(FixedBytes<32>, TrieUpdates), ProviderError>
fn state_root_with_updates( &self, hashed_state: HashedPostState, ) -> Result<(FixedBytes<32>, TrieUpdates), ProviderError>
HashedPostState
on top of the current state with trie
updates to be committed to the database.Source§fn state_root_from_nodes_with_updates(
&self,
input: TrieInput,
) -> Result<(FixedBytes<32>, TrieUpdates), ProviderError>
fn state_root_from_nodes_with_updates( &self, input: TrieInput, ) -> Result<(FixedBytes<32>, TrieUpdates), ProviderError>
StateRootProvider::state_root_from_nodes
for more info.Source§impl<U> StatsReader for Arc<U>
impl<U> StatsReader for Arc<U>
Source§fn count_entries<T>(&self) -> Result<usize, ProviderError>where
T: Table,
fn count_entries<T>(&self) -> Result<usize, ProviderError>where
T: Table,
Source§impl<T> StorageChangeSetReader for Arc<T>
impl<T> StorageChangeSetReader for Arc<T>
Source§impl<T> StorageReader for Arc<T>
impl<T> StorageReader for Arc<T>
Source§fn plain_state_storages(
&self,
addresses_with_keys: impl IntoIterator<Item = (Address, impl IntoIterator<Item = FixedBytes<32>>)>,
) -> Result<Vec<(Address, Vec<StorageEntry>)>, ProviderError>
fn plain_state_storages( &self, addresses_with_keys: impl IntoIterator<Item = (Address, impl IntoIterator<Item = FixedBytes<32>>)>, ) -> Result<Vec<(Address, Vec<StorageEntry>)>, ProviderError>
Source§fn changed_storages_with_range(
&self,
range: RangeInclusive<u64>,
) -> Result<BTreeMap<Address, BTreeSet<FixedBytes<32>>>, ProviderError>
fn changed_storages_with_range( &self, range: RangeInclusive<u64>, ) -> Result<BTreeMap<Address, BTreeSet<FixedBytes<32>>>, ProviderError>
Source§fn changed_storages_and_blocks_with_range(
&self,
range: RangeInclusive<u64>,
) -> Result<BTreeMap<(Address, FixedBytes<32>), Vec<u64>>, ProviderError>
fn changed_storages_and_blocks_with_range( &self, range: RangeInclusive<u64>, ) -> Result<BTreeMap<(Address, FixedBytes<32>), Vec<u64>>, ProviderError>
Source§impl<T> StorageRootProvider for Arc<T>
impl<T> StorageRootProvider for Arc<T>
Source§fn storage_root(
&self,
address: Address,
hashed_storage: HashedStorage,
) -> Result<FixedBytes<32>, ProviderError>
fn storage_root( &self, address: Address, hashed_storage: HashedStorage, ) -> Result<FixedBytes<32>, ProviderError>
HashedStorage
for target address on top of the current
state.Source§fn storage_proof(
&self,
address: Address,
slot: FixedBytes<32>,
hashed_storage: HashedStorage,
) -> Result<StorageProof, ProviderError>
fn storage_proof( &self, address: Address, slot: FixedBytes<32>, hashed_storage: HashedStorage, ) -> Result<StorageProof, ProviderError>
HashedStorage
for target slot on top of the current
state.Source§fn storage_multiproof(
&self,
address: Address,
slots: &[FixedBytes<32>],
hashed_storage: HashedStorage,
) -> Result<StorageMultiProof, ProviderError>
fn storage_multiproof( &self, address: Address, slots: &[FixedBytes<32>], hashed_storage: HashedStorage, ) -> Result<StorageMultiProof, ProviderError>
Source§impl<T> StorageTrieWriter for Arc<T>
impl<T> StorageTrieWriter for Arc<T>
Source§fn write_storage_trie_updates(
&self,
storage_tries: &HashMap<FixedBytes<32>, StorageTrieUpdates, FbBuildHasher<32>>,
) -> Result<usize, ProviderError>
fn write_storage_trie_updates( &self, storage_tries: &HashMap<FixedBytes<32>, StorageTrieUpdates, FbBuildHasher<32>>, ) -> Result<usize, ProviderError>
Source§fn write_individual_storage_trie_updates(
&self,
hashed_address: FixedBytes<32>,
updates: &StorageTrieUpdates,
) -> Result<usize, ProviderError>
fn write_individual_storage_trie_updates( &self, hashed_address: FixedBytes<32>, updates: &StorageTrieUpdates, ) -> Result<usize, ProviderError>
§impl<S> Strategy for Arc<S>where
S: Strategy + ?Sized,
impl<S> Strategy for Arc<S>where
S: Strategy + ?Sized,
§type Value = <S as Strategy>::Value
type Value = <S as Strategy>::Value
§fn new_tree(
&self,
runner: &mut TestRunner,
) -> Result<<Arc<S> as Strategy>::Tree, Reason>
fn new_tree( &self, runner: &mut TestRunner, ) -> Result<<Arc<S> as Strategy>::Tree, Reason>
§fn prop_map<O, F>(self, fun: F) -> Map<Self, F>
fn prop_map<O, F>(self, fun: F) -> Map<Self, F>
fun
. Read more§fn prop_map_into<O>(self) -> MapInto<Self, O>
fn prop_map_into<O>(self) -> MapInto<Self, O>
§fn prop_perturb<O, F>(self, fun: F) -> Perturb<Self, F>
fn prop_perturb<O, F>(self, fun: F) -> Perturb<Self, F>
fun
, which is additionally given a random number generator. Read more§fn prop_flat_map<S, F>(self, fun: F) -> Flatten<Map<Self, F>>
fn prop_flat_map<S, F>(self, fun: F) -> Flatten<Map<Self, F>>
§fn prop_ind_flat_map<S, F>(self, fun: F) -> IndFlatten<Map<Self, F>>
fn prop_ind_flat_map<S, F>(self, fun: F) -> IndFlatten<Map<Self, F>>
§fn prop_ind_flat_map2<S, F>(self, fun: F) -> IndFlattenMap<Self, F>
fn prop_ind_flat_map2<S, F>(self, fun: F) -> IndFlattenMap<Self, F>
prop_ind_flat_map()
, but produces 2-tuples with the input
generated from self
in slot 0 and the derived strategy in slot 1. Read more§fn prop_filter<R, F>(self, whence: R, fun: F) -> Filter<Self, F>
fn prop_filter<R, F>(self, whence: R, fun: F) -> Filter<Self, F>
fun
. Read more§fn prop_filter_map<F, O>(
self,
whence: impl Into<Reason>,
fun: F,
) -> FilterMap<Self, F>
fn prop_filter_map<F, O>( self, whence: impl Into<Reason>, fun: F, ) -> FilterMap<Self, F>
fun
returns Some(value)
and rejects those where fun
returns None
. Read more§fn prop_union(self, other: Self) -> Union<Self>where
Self: Sized,
fn prop_union(self, other: Self) -> Union<Self>where
Self: Sized,
§fn prop_recursive<R, F>(
self,
depth: u32,
desired_size: u32,
expected_branch_size: u32,
recurse: F,
) -> Recursive<Self::Value, F>
fn prop_recursive<R, F>( self, depth: u32, desired_size: u32, expected_branch_size: u32, recurse: F, ) -> Recursive<Self::Value, F>
self
items as leaves. Read more§fn prop_shuffle(self) -> Shuffle<Self>where
Self: Sized,
Self::Value: Shuffleable,
fn prop_shuffle(self) -> Shuffle<Self>where
Self: Sized,
Self::Value: Shuffleable,
§fn boxed(self) -> BoxedStrategy<Self::Value>where
Self: Sized + 'static,
fn boxed(self) -> BoxedStrategy<Self::Value>where
Self: Sized + 'static,
Strategy
so it can be passed around as a
simple trait object. Read more§impl<S> Subscriber for Arc<S>where
S: Subscriber + ?Sized,
impl<S> Subscriber for Arc<S>where
S: Subscriber + ?Sized,
§fn register_callsite(&self, metadata: &'static Metadata<'static>) -> Interest
fn register_callsite(&self, metadata: &'static Metadata<'static>) -> Interest
§fn max_level_hint(&self) -> Option<LevelFilter>
fn max_level_hint(&self) -> Option<LevelFilter>
Subscriber
will
enable, or None
, if the subscriber does not implement level-based
filtering or chooses not to implement this method. Read more§fn record_follows_from(&self, span: &Id, follows: &Id)
fn record_follows_from(&self, span: &Id, follows: &Id)
§fn event_enabled(&self, event: &Event<'_>) -> bool
fn event_enabled(&self, event: &Event<'_>) -> bool
Event
] should be recorded. Read more§fn clone_span(&self, id: &Id) -> Id
fn clone_span(&self, id: &Id) -> Id
§fn drop_span(&self, id: Id)
fn drop_span(&self, id: Id)
Subscriber::try_close
instead§fn current_span(&self) -> Current
fn current_span(&self) -> Current
§unsafe fn downcast_raw(&self, id: TypeId) -> Option<*const ()>
unsafe fn downcast_raw(&self, id: TypeId) -> Option<*const ()>
self
is the same type as the provided TypeId
, returns an untyped
*const
pointer to that type. Otherwise, returns None
. Read more§fn on_register_dispatch(&self, subscriber: &Dispatch)
fn on_register_dispatch(&self, subscriber: &Dispatch)
Dispatch
]. Read more§impl<T> Transaction for Arc<T>
impl<T> Transaction for Arc<T>
§fn max_fee_per_gas(&self) -> u128
fn max_fee_per_gas(&self) -> u128
§fn max_priority_fee_per_gas(&self) -> Option<u128>
fn max_priority_fee_per_gas(&self) -> Option<u128>
§fn max_fee_per_blob_gas(&self) -> Option<u128>
fn max_fee_per_blob_gas(&self) -> Option<u128>
§fn priority_fee_or_price(&self) -> u128
fn priority_fee_or_price(&self) -> u128
§fn effective_gas_price(&self, base_fee: Option<u64>) -> u128
fn effective_gas_price(&self, base_fee: Option<u64>) -> u128
§fn effective_tip_per_gas(&self, base_fee: u64) -> Option<u128>
fn effective_tip_per_gas(&self, base_fee: u64) -> Option<u128>
§fn is_dynamic_fee(&self) -> bool
fn is_dynamic_fee(&self) -> bool
true
if the transaction supports dynamic fees.§fn is_create(&self) -> bool
fn is_create(&self) -> bool
kind
as it copies the 21-byte
TxKind
for this simple check. A proper implementation shouldn’t allocate.§fn to(&self) -> Option<Address>
fn to(&self) -> Option<Address>
§fn access_list(&self) -> Option<&AccessList>
fn access_list(&self) -> Option<&AccessList>
access_list
for the particular transaction type. Returns None
for
older transaction types.§fn blob_versioned_hashes(&self) -> Option<&[FixedBytes<32>]>
fn blob_versioned_hashes(&self) -> Option<&[FixedBytes<32>]>
None
.§fn blob_gas_used(&self) -> Option<u64>
fn blob_gas_used(&self) -> Option<u64>
SignedAuthorization
list of the transaction. Read moreSource§impl<T> TransactionsProvider for Arc<T>
impl<T> TransactionsProvider for Arc<T>
Source§type Transaction = <T as TransactionsProvider>::Transaction
type Transaction = <T as TransactionsProvider>::Transaction
Source§fn transaction_id(
&self,
tx_hash: FixedBytes<32>,
) -> Result<Option<u64>, ProviderError>
fn transaction_id( &self, tx_hash: FixedBytes<32>, ) -> Result<Option<u64>, ProviderError>
Source§fn transaction_by_id(
&self,
id: u64,
) -> Result<Option<<Arc<T> as TransactionsProvider>::Transaction>, ProviderError>
fn transaction_by_id( &self, id: u64, ) -> Result<Option<<Arc<T> as TransactionsProvider>::Transaction>, ProviderError>
Source§fn transaction_by_id_unhashed(
&self,
id: u64,
) -> Result<Option<<Arc<T> as TransactionsProvider>::Transaction>, ProviderError>
fn transaction_by_id_unhashed( &self, id: u64, ) -> Result<Option<<Arc<T> as TransactionsProvider>::Transaction>, ProviderError>
Source§fn transaction_by_hash(
&self,
hash: FixedBytes<32>,
) -> Result<Option<<Arc<T> as TransactionsProvider>::Transaction>, ProviderError>
fn transaction_by_hash( &self, hash: FixedBytes<32>, ) -> Result<Option<<Arc<T> as TransactionsProvider>::Transaction>, ProviderError>
Source§fn transaction_by_hash_with_meta(
&self,
hash: FixedBytes<32>,
) -> Result<Option<(<Arc<T> as TransactionsProvider>::Transaction, TransactionMeta)>, ProviderError>
fn transaction_by_hash_with_meta( &self, hash: FixedBytes<32>, ) -> Result<Option<(<Arc<T> as TransactionsProvider>::Transaction, TransactionMeta)>, ProviderError>
Source§fn transaction_block(&self, id: u64) -> Result<Option<u64>, ProviderError>
fn transaction_block(&self, id: u64) -> Result<Option<u64>, ProviderError>
Source§fn transactions_by_block(
&self,
block: HashOrNumber,
) -> Result<Option<Vec<<Arc<T> as TransactionsProvider>::Transaction>>, ProviderError>
fn transactions_by_block( &self, block: HashOrNumber, ) -> Result<Option<Vec<<Arc<T> as TransactionsProvider>::Transaction>>, ProviderError>
Source§fn transactions_by_block_range(
&self,
range: impl RangeBounds<u64>,
) -> Result<Vec<Vec<<Arc<T> as TransactionsProvider>::Transaction>>, ProviderError>
fn transactions_by_block_range( &self, range: impl RangeBounds<u64>, ) -> Result<Vec<Vec<<Arc<T> as TransactionsProvider>::Transaction>>, ProviderError>
Source§fn transactions_by_tx_range(
&self,
range: impl RangeBounds<u64>,
) -> Result<Vec<<Arc<T> as TransactionsProvider>::Transaction>, ProviderError>
fn transactions_by_tx_range( &self, range: impl RangeBounds<u64>, ) -> Result<Vec<<Arc<T> as TransactionsProvider>::Transaction>, ProviderError>
Source§fn senders_by_tx_range(
&self,
range: impl RangeBounds<u64>,
) -> Result<Vec<Address>, ProviderError>
fn senders_by_tx_range( &self, range: impl RangeBounds<u64>, ) -> Result<Vec<Address>, ProviderError>
Source§impl<T> TransactionsProviderExt for Arc<T>
impl<T> TransactionsProviderExt for Arc<T>
Source§fn transaction_range_by_block_range(
&self,
block_range: RangeInclusive<u64>,
) -> Result<RangeInclusive<u64>, ProviderError>
fn transaction_range_by_block_range( &self, block_range: RangeInclusive<u64>, ) -> Result<RangeInclusive<u64>, ProviderError>
Source§fn transaction_hashes_by_range(
&self,
tx_range: Range<u64>,
) -> Result<Vec<(FixedBytes<32>, u64)>, ProviderError>
fn transaction_hashes_by_range( &self, tx_range: Range<u64>, ) -> Result<Vec<(FixedBytes<32>, u64)>, ProviderError>
Source§impl<T> TrieWriter for Arc<T>
impl<T> TrieWriter for Arc<T>
§impl<T> TxReceipt for Arc<T>
impl<T> TxReceipt for Arc<T>
§fn status_or_post_state(&self) -> Eip658Value
fn status_or_post_state(&self) -> Eip658Value
§fn bloom(&self) -> Bloom
fn bloom(&self) -> Bloom
§fn bloom_cheap(&self) -> Option<Bloom>
fn bloom_cheap(&self) -> Option<Bloom>
§fn cumulative_gas_used(&self) -> u64
fn cumulative_gas_used(&self) -> u64
§fn with_bloom_ref(&self) -> ReceiptWithBloom<&Self>
fn with_bloom_ref(&self) -> ReceiptWithBloom<&Self>
ReceiptWithBloom
] with the computed bloom filter [Self::bloom
] and a reference
to the receipt.§fn into_with_bloom(self) -> ReceiptWithBloom<Self>
fn into_with_bloom(self) -> ReceiptWithBloom<Self>
ReceiptWithBloom
] with the computed bloom filter
[Self::bloom
] and the receipt.§impl<Signature, T> TxSigner<Signature> for Arc<T>where
T: TxSigner<Signature> + ?Sized,
impl<Signature, T> TxSigner<Signature> for Arc<T>where
T: TxSigner<Signature> + ?Sized,
§fn sign_transaction<'life0, 'life1, 'async_trait>(
&'life0 self,
tx: &'life1 mut (dyn SignableTransaction<Signature> + 'static),
) -> Pin<Box<dyn Future<Output = Result<Signature, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Arc<T>: 'async_trait,
fn sign_transaction<'life0, 'life1, 'async_trait>(
&'life0 self,
tx: &'life1 mut (dyn SignableTransaction<Signature> + 'static),
) -> Pin<Box<dyn Future<Output = Result<Signature, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Arc<T>: 'async_trait,
Source§impl<T> WithdrawalsProvider for Arc<T>
impl<T> WithdrawalsProvider for Arc<T>
§impl<'a, T> Writeable for Arc<T>where
T: Writeable + ?Sized,
impl<'a, T> Writeable for Arc<T>where
T: Writeable + ?Sized,
§fn write_to<W>(&self, sink: &mut W) -> Result<(), Error>
fn write_to<W>(&self, sink: &mut W) -> Result<(), Error>
write_to_parts
, and discards any
Part
annotations.§fn write_to_parts<W>(&self, sink: &mut W) -> Result<(), Error>where
W: PartsWrite + ?Sized,
fn write_to_parts<W>(&self, sink: &mut W) -> Result<(), Error>where
W: PartsWrite + ?Sized,
Part
annotations to the given sink. Errors from the
sink are bubbled up. The default implementation delegates to write_to
,
and doesn’t produce any Part
annotations.§fn writeable_length_hint(&self) -> LengthHint
fn writeable_length_hint(&self) -> LengthHint
§fn write_to_string(&self) -> Cow<'_, str>
fn write_to_string(&self) -> Cow<'_, str>
String
with the data from this Writeable
. Like ToString
,
but smaller and faster. Read more§fn writeable_cmp_bytes(&self, other: &[u8]) -> Ordering
fn writeable_cmp_bytes(&self, other: &[u8]) -> Ordering
Writeable
to the given bytes
without allocating a String to hold the Writeable
contents. Read moreimpl<T> CartablePointerLike for Arc<T>
alloc
only.impl<T> CloneStableDeref for Arc<T>where
T: ?Sized,
alloc
only.impl<T> CloneableCart for Arc<T>where
T: ?Sized,
alloc
only.impl<T> CloneableCartablePointerLike for Arc<T>
alloc
only.impl<T, U, A> CoerceUnsized<Arc<U, A>> for Arc<T, A>
impl<T, A> DerefPure for Arc<T, A>
impl<T, U> DispatchFromDyn<Arc<U>> for Arc<T>
impl<T> EncodeLike<T> for Arc<T>where
T: Encode,
impl<T> EncodeLike for Arc<T>where
T: Encode + ?Sized,
impl<T, A> Eq for Arc<T, A>
impl<T, A> PinCoerceUnsized for Arc<T, A>
impl<T> Receipt for Arc<T>
impl<T, A> Send for Arc<T, A>
impl<T> StableDeref for Arc<T>where
T: ?Sized,
alloc
only.