reth_revm::handler::execution

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,

1.17.0 · Source

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 as T. This is trivially true if U is T.
  • If U is unsized, its data pointer must have the same size and alignment as T. This is trivially true if Arc<U> was constructed through Arc<T> and then converted to Arc<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 · Source

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 · Source

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>

1.0.0 · Source

pub fn new(data: T) -> Arc<T>

Available on non-no_global_oom_handling only.

Constructs a new Arc<T>.

§Examples
use std::sync::Arc;

let five = Arc::new(5);
1.60.0 · Source

pub fn new_cyclic<F>(data_fn: F) -> Arc<T>
where F: FnOnce(&Weak<T>) -> T,

Available on non-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 · Source

pub fn new_uninit() -> Arc<MaybeUninit<T>>

Available on non-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)
Source

pub 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.

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 · Source

pub fn pin(data: T) -> Pin<Arc<T>>

Available on non-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.

Source

pub fn try_pin(data: T) -> Result<Pin<Arc<T>>, AllocError>

🔬This is a nightly-only experimental API. (allocator_api #32838)

Constructs a new Pin<Arc<T>>, return an error if allocation fails.

Source

pub fn try_new(data: T) -> Result<Arc<T>, AllocError>

🔬This is a nightly-only experimental API. (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)?;
Source

pub fn try_new_uninit() -> Result<Arc<MaybeUninit<T>>, AllocError>

🔬This is a nightly-only experimental API. (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);
Source

pub fn try_new_zeroed() -> Result<Arc<MaybeUninit<T>>, AllocError>

🔬This is a nightly-only experimental API. (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>
where A: Allocator, T: ?Sized,

Source

pub fn allocator(this: &Arc<T, A>) -> &A

🔬This is a nightly-only experimental API. (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 · Source

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

pub fn into_raw_with_allocator(this: Arc<T, A>) -> (*const T, A)

🔬This is a nightly-only experimental API. (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 · Source

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

pub unsafe fn from_raw_in(ptr: *const T, alloc: A) -> Arc<T, A>

🔬This is a nightly-only experimental API. (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 as T. This is trivially true if U is T.
  • If U is unsized, its data pointer must have the same size and alignment as T. This is trivially true if Arc<U> was constructed through Arc<T> and then converted to Arc<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.4.0 · Source

pub fn downgrade(this: &Arc<T, A>) -> Weak<T, A>
where A: Clone,

Creates a new Weak pointer to this allocation.

§Examples
use std::sync::Arc;

let five = Arc::new(5);

let weak_five = Arc::downgrade(&five);
1.15.0 · Source

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 · Source

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

pub unsafe fn increment_strong_count_in(ptr: *const T, alloc: A)
where A: Clone,

🔬This is a nightly-only experimental API. (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));
}
Source

pub unsafe fn decrement_strong_count_in(ptr: *const T, alloc: A)

🔬This is a nightly-only experimental API. (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 · Source

pub fn ptr_eq(this: &Arc<T, A>, other: &Arc<T, A>) -> bool

Returns true if the two Arcs 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>
where T: CloneToUninit + ?Sized, A: Allocator + Clone,

1.4.0 · Source

pub fn make_mut(this: &mut Arc<T, A>) -> &mut T

Available on non-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>
where T: Clone, A: Allocator,

1.76.0 · Source

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>
where A: Allocator, T: ?Sized,

1.4.0 · Source

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

pub unsafe fn get_mut_unchecked(this: &mut Arc<T, A>) -> &mut T

🔬This is a nightly-only experimental API. (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,

Source

pub 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.

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

pub 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.

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

pub 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.

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

pub fn new_cyclic_in<F>(data_fn: F, alloc: A) -> Arc<T, A>
where F: FnOnce(&Weak<T, A>) -> T,

🔬This is a nightly-only experimental API. (allocator_api #32838)
Available on non-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

Source

pub 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.

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.

Source

pub 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)

Constructs a new Pin<Arc<T, A>> in the provided allocator, return an error if allocation fails.

Source

pub fn try_new_in(data: T, alloc: A) -> Result<Arc<T, A>, AllocError>

🔬This is a nightly-only experimental API. (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)?;
Source

pub fn try_new_uninit_in(alloc: A) -> Result<Arc<MaybeUninit<T>, A>, AllocError>

🔬This is a nightly-only experimental API. (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);
Source

pub fn try_new_zeroed_in(alloc: A) -> Result<Arc<MaybeUninit<T>, A>, AllocError>

🔬This is a nightly-only experimental API. (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 · Source

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 · Source

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>
where T: AccountExtReader + ?Sized, Arc<T>: Send + Sync,

Source§

fn changed_accounts_with_range( &self, _range: impl RangeBounds<u64>, ) -> Result<BTreeSet<Address>, ProviderError>

Iterate over account changesets and return all account address that were changed.
Source§

fn basic_accounts( &self, _iter: impl IntoIterator<Item = Address>, ) -> Result<Vec<(Address, Option<Account>)>, ProviderError>

Get basic account information for multiple accounts. A more efficient version than calling AccountReader::basic_account repeatedly. Read more
Source§

fn changed_accounts_and_blocks_with_range( &self, range: RangeInclusive<u64>, ) -> Result<BTreeMap<Address, Vec<u64>>, ProviderError>

Iterate over account changesets and return all account addresses that were changed alongside each specific set of blocks. Read more
Source§

impl<T> AccountReader for Arc<T>
where T: AccountReader + ?Sized, Arc<T>: Send + Sync,

Source§

fn basic_account( &self, address: &Address, ) -> Result<Option<Account>, ProviderError>

Get basic account information. Read more
§

impl<T> AnyProvider for Arc<T>
where T: AnyProvider + ?Sized,

Available on target_has_atomic="ptr" only.
§

fn load_any( &self, key: DataKey, req: DataRequest<'_>, ) -> Result<AnyResponse, DataError>

Loads an [AnyPayload] according to the key and request.
§

impl<'a, A> Arbitrary<'a> for Arc<A>
where A: Arbitrary<'a>,

§

fn arbitrary(u: &mut Unstructured<'a>) -> Result<Arc<A>, Error>

Generate an arbitrary value of Self from the given unstructured data. Read more
§

fn size_hint(depth: usize) -> (usize, Option<usize>)

Get a size hint for how many bytes out of an Unstructured this type needs to construct itself. Read more
§

fn try_size_hint( depth: usize, ) -> Result<(usize, Option<usize>), MaxRecursionReached>

Get a size hint for how many bytes out of an Unstructured this type needs to construct itself. Read more
§

fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>

Generate an arbitrary value of Self from the entirety of the given unstructured data. Read more
§

impl<A> Arbitrary for Arc<A>
where A: Arbitrary,

§

type Parameters = <A as Arbitrary>::Parameters

The type of parameters that arbitrary_with accepts for configuration of the generated Strategy. Parameters must implement Default.
§

type Strategy = MapInto<<A as Arbitrary>::Strategy, Arc<A>>

The type of Strategy used to generate values of type Self.
§

fn arbitrary_with( args: <Arc<A> as Arbitrary>::Parameters, ) -> <Arc<A> as Arbitrary>::Strategy

Generates a Strategy for producing arbitrary values of type the implementing type (Self). The strategy is passed the arguments given in args. Read more
§

fn arbitrary() -> Self::Strategy

Generates a Strategy for producing arbitrary values of type the implementing type (Self). Read more
§

impl<A> ArbitraryF1<A> for Arc<A>
where A: Debug + 'static,

§

type Parameters = ()

The type of parameters that 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,

Lifts a given Strategy to a new Strategy for the (presumably) bigger type. This is useful for lifting a Strategy for SomeType to a container such as Vec of SomeType. The composite strategy is passed the arguments given in args. Read more
§

fn lift1<AS>(base: AS) -> BoxedStrategy<Self>
where AS: Strategy<Value = A> + 'static,

Lifts a given Strategy to a new Strategy for the (presumably) bigger type. This is useful for lifting a Strategy for SomeType to a container such as Vec<SomeType>. Read more
1.64.0 · Source§

impl<T> AsFd for Arc<T>
where T: AsFd + ?Sized,

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<'_>

Borrows the file descriptor. Read more
1.63.0 · Source§

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§

fn as_raw_fd(&self) -> i32

Extracts the raw file descriptor. Read more
1.5.0 · Source§

impl<T, A> AsRef<T> for Arc<T, A>
where A: Allocator, T: ?Sized,

Source§

fn as_ref(&self) -> &T

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<T> BlockBodyIndicesProvider for Arc<T>

Source§

fn block_body_indices( &self, num: u64, ) -> Result<Option<StoredBlockBodyIndices>, ProviderError>

Returns the block body indices with matching number from database. Read more
Source§

impl<Provider, T> BlockBodyReader<Provider> for Arc<T>
where T: BlockBodyReader<Provider> + ?Sized,

Source§

type Block = <T as BlockBodyReader<Provider>>::Block

The block type.
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>

Receives a list of block headers along with block transactions and returns the block bodies.
Source§

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>

Writes a set of block bodies to the storage.
Source§

fn remove_block_bodies_above( &self, provider: &Provider, block: u64, remove_from: StorageLocation, ) -> Result<(), ProviderError>

Removes all block bodies above the given block number from the database.
§

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>

Get block hash by block number
Source§

impl<T> BlockHashReader for Arc<T>
where T: BlockHashReader + ?Sized, Arc<T>: Send + Sync,

Source§

fn block_hash( &self, number: u64, ) -> Result<Option<FixedBytes<32>>, ProviderError>

Get the hash of the block with the given number. Returns None if no block with this number exists.
Source§

fn convert_block_hash( &self, hash_or_number: HashOrNumber, ) -> Result<Option<FixedBytes<32>>, ProviderError>

Get the hash of the block with the given number. Returns None if no block with this number exists.
Source§

fn canonical_hashes_range( &self, start: u64, end: u64, ) -> Result<Vec<FixedBytes<32>>, ProviderError>

Get headers in range of block hashes or numbers Read more
§

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>

Get block hash by block number
§

impl<T> BlockHeader for Arc<T>
where T: BlockHeader + ?Sized,

§

fn parent_hash(&self) -> FixedBytes<32>

Retrieves the parent hash of the block
§

fn ommers_hash(&self) -> FixedBytes<32>

Retrieves the ommers hash of the block
§

fn beneficiary(&self) -> Address

Retrieves the beneficiary (miner) of the block
§

fn state_root(&self) -> FixedBytes<32>

Retrieves the state root hash of the block
§

fn transactions_root(&self) -> FixedBytes<32>

Retrieves the transactions root hash of the block
§

fn receipts_root(&self) -> FixedBytes<32>

Retrieves the receipts root hash of the block
§

fn withdrawals_root(&self) -> Option<FixedBytes<32>>

Retrieves the withdrawals root hash of the block, if available
§

fn logs_bloom(&self) -> Bloom

Retrieves the logs bloom filter of the block
§

fn difficulty(&self) -> Uint<256, 4>

Retrieves the difficulty of the block
§

fn number(&self) -> u64

Retrieves the block number
§

fn gas_limit(&self) -> u64

Retrieves the gas limit of the block
§

fn gas_used(&self) -> u64

Retrieves the gas used by the block
§

fn timestamp(&self) -> u64

Retrieves the timestamp of the block
§

fn mix_hash(&self) -> Option<FixedBytes<32>>

Retrieves the mix hash of the block, if available
§

fn nonce(&self) -> Option<FixedBytes<8>>

Retrieves the nonce of the block, if avaialble
§

fn base_fee_per_gas(&self) -> Option<u64>

Retrieves the base fee per gas of the block, if available
§

fn blob_gas_used(&self) -> Option<u64>

Retrieves the blob gas used by the block, if available
§

fn excess_blob_gas(&self) -> Option<u64>

Retrieves the excess blob gas of the block, if available
§

fn parent_beacon_block_root(&self) -> Option<FixedBytes<32>>

Retrieves the parent beacon block root of the block, if available
§

fn requests_hash(&self) -> Option<FixedBytes<32>>

Retrieves the requests hash of the block, if available
§

fn extra_data(&self) -> &Bytes

Retrieves the block’s extra data field
§

fn blob_fee(&self, blob_params: BlobParams) -> Option<u128>

Returns the blob fee for this block according to the EIP-4844 spec. Read more
§

fn next_block_excess_blob_gas(&self, blob_params: BlobParams) -> Option<u64>

Calculate excess blob gas for the next block according to the EIP-4844 spec. Read more
§

fn next_block_blob_fee(&self, blob_params: BlobParams) -> Option<u128>

Returns the blob fee for the next block according to the EIP-4844 spec. Read more
§

fn next_block_base_fee(&self, base_fee_params: BaseFeeParams) -> Option<u64>

Calculate base fee for next block according to the EIP-1559 spec. Read more
§

fn parent_num_hash(&self) -> NumHash

Returns the parent block’s number and hash Read more
§

fn is_empty(&self) -> bool

Checks if the header is considered empty - has no transactions, no ommers or withdrawals
§

fn is_zero_difficulty(&self) -> bool

Checks if the block’s difficulty is set to zero, indicating a Proof-of-Stake header. Read more
§

fn exceeds_allowed_future_timestamp(&self, present_timestamp: u64) -> bool

Checks if the block’s timestamp is in the future based on the present timestamp. Read more
§

fn is_nonce_zero(&self) -> bool

Checks if the nonce exists, and if it exists, if it’s zero. Read more
Source§

impl<T> BlockIdReader for Arc<T>

Source§

fn convert_block_number( &self, num: BlockNumberOrTag, ) -> Result<Option<u64>, ProviderError>

Converts the BlockNumberOrTag variants to a block number.
Source§

fn block_hash_for_id( &self, block_id: BlockId, ) -> Result<Option<FixedBytes<32>>, ProviderError>

Get the hash of the block by matching the given id.
Source§

fn block_number_for_id( &self, block_id: BlockId, ) -> Result<Option<u64>, ProviderError>

Get the number of the block by matching the given id.
Source§

fn pending_block_num_hash(&self) -> Result<Option<NumHash>, ProviderError>

Get the current pending block number and hash.
Source§

fn safe_block_num_hash(&self) -> Result<Option<NumHash>, ProviderError>

Get the current safe block number and hash.
Source§

fn finalized_block_num_hash(&self) -> Result<Option<NumHash>, ProviderError>

Get the current finalized block number and hash.
Source§

fn safe_block_number(&self) -> Result<Option<u64>, ProviderError>

Get the safe block number.
Source§

fn finalized_block_number(&self) -> Result<Option<u64>, ProviderError>

Get the finalized block number.
Source§

fn safe_block_hash(&self) -> Result<Option<FixedBytes<32>>, ProviderError>

Get the safe block hash.
Source§

fn finalized_block_hash(&self) -> Result<Option<FixedBytes<32>>, ProviderError>

Get the finalized block hash.
Source§

impl<T> BlockNumReader for Arc<T>

Source§

fn chain_info(&self) -> Result<ChainInfo, ProviderError>

Returns the current info for the chain.
Source§

fn best_block_number(&self) -> Result<u64, ProviderError>

Returns the best block number in the chain.
Source§

fn last_block_number(&self) -> Result<u64, ProviderError>

Returns the last block number associated with the last canonical header in the database.
Source§

fn block_number( &self, hash: FixedBytes<32>, ) -> Result<Option<u64>, ProviderError>

Gets the 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>

Gets the block number for the given 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>

Gets the block hash for the given 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,

Source§

type Block = <T as BlockReader>::Block

The block type this provider reads.
Source§

fn find_block_by_hash( &self, hash: FixedBytes<32>, source: BlockSource, ) -> Result<Option<<Arc<T> as BlockReader>::Block>, ProviderError>

Tries to find in the given block source. Read more
Source§

fn block( &self, id: HashOrNumber, ) -> Result<Option<<Arc<T> as BlockReader>::Block>, ProviderError>

Returns the block with given id from the database. Read more
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>

Returns the pending block if available Read more
Source§

fn pending_block_with_senders( &self, ) -> Result<Option<SealedBlockWithSenders<<Arc<T> as BlockReader>::Block>>, ProviderError>

Returns the pending block if available Read more
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>

Returns the pending block and receipts if available.
Source§

fn block_by_hash( &self, hash: FixedBytes<32>, ) -> Result<Option<<Arc<T> as BlockReader>::Block>, ProviderError>

Returns the block with matching hash from the database. Read more
Source§

fn block_by_number( &self, num: u64, ) -> Result<Option<<Arc<T> as BlockReader>::Block>, ProviderError>

Returns the block with matching number from database. Read more
Source§

fn block_with_senders( &self, id: HashOrNumber, transaction_kind: TransactionVariant, ) -> Result<Option<BlockWithSenders<<Arc<T> as BlockReader>::Block>>, ProviderError>

Returns the block with senders with matching number or hash from database. Read more
Source§

fn sealed_block_with_senders( &self, id: HashOrNumber, transaction_kind: TransactionVariant, ) -> Result<Option<SealedBlockWithSenders<<Arc<T> as BlockReader>::Block>>, ProviderError>

Returns the sealed block with senders with matching number or hash from database. Read more
Source§

fn block_range( &self, range: RangeInclusive<u64>, ) -> Result<Vec<<Arc<T> as BlockReader>::Block>, ProviderError>

Returns all blocks in the given inclusive range. Read more
Source§

fn block_with_senders_range( &self, range: RangeInclusive<u64>, ) -> Result<Vec<BlockWithSenders<<Arc<T> as BlockReader>::Block>>, ProviderError>

Returns a range of blocks from the database, along with the senders of each transaction in the blocks.
Source§

fn sealed_block_with_senders_range( &self, range: RangeInclusive<u64>, ) -> Result<Vec<SealedBlockWithSenders<<Arc<T> as BlockReader>::Block>>, ProviderError>

Returns a range of sealed blocks from the database, along with the senders of each transaction in the blocks.
1.0.0 · Source§

impl<T, A> Borrow<T> for Arc<T, A>
where A: Allocator, T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<M, P> BoundDataProvider<M> for Arc<P>
where M: DataMarker, P: BoundDataProvider<M> + ?Sized,

Available on target_has_atomic="ptr" only.
§

fn load_bound(&self, req: DataRequest<'_>) -> Result<DataResponse<M>, DataError>

Query the provider for data, returning the result. Read more
§

fn bound_key(&self) -> DataKey

Returns the [DataKey] that this provider uses for loading data.
§

impl<T> BufferProvider for Arc<T>
where T: BufferProvider + ?Sized,

Available on target_has_atomic="ptr" only.
§

fn load_buffer( &self, key: DataKey, req: DataRequest<'_>, ) -> Result<DataResponse<BufferMarker>, DataError>

Loads a [DataPayload]<[BufferMarker]> according to the key and request.
§

impl<T> ChainSpecProvider for Arc<T>
where T: ChainSpecProvider + ?Sized, Arc<T>: Send + Sync,

§

type ChainSpec = <T as ChainSpecProvider>::ChainSpec

The chain spec type.
§

fn chain_spec(&self) -> Arc<<Arc<T> as ChainSpecProvider>::ChainSpec>

Get an Arc to the chainspec.
Source§

impl<T> ChangeSetReader for Arc<T>
where T: ChangeSetReader + ?Sized, Arc<T>: Send + Sync,

Source§

fn account_block_changeset( &self, block_number: u64, ) -> Result<Vec<AccountBeforeTx>, ProviderError>

Iterate over account changesets and return the account state from before this block.
1.0.0 · Source§

impl<T, A> Clone for Arc<T, A>
where A: Allocator + Clone, T: ?Sized,

Source§

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)

Performs copy-assignment from source. Read more
§

impl<H, B, T> Consensus<H, B> for Arc<T>
where T: Consensus<H, B> + ?Sized, Arc<T>: AsHeaderValidator<H>,

§

type Error = <T as Consensus<H, B>>::Error

The error type related to consensus.
§

fn validate_body_against_header( &self, body: &B, header: &SealedHeader<H>, ) -> Result<(), <Arc<T> as Consensus<H, B>>::Error>

Ensures that body field values match the header.
§

fn validate_block_pre_execution( &self, block: &SealedBlock<H, B>, ) -> Result<(), <Arc<T> as Consensus<H, B>>::Error>

Validate a block disregarding world state, i.e. things that can be checked before sender recovery and execution. Read more
§

impl<T> CounterFn for Arc<T>
where T: CounterFn,

§

fn increment(&self, value: u64)

Increments the counter by the given amount.
§

fn absolute(&self, value: u64)

Sets the counter to at least the given amount. Read more
§

impl<M, P> DataProvider<M> for Arc<P>
where M: KeyedDataMarker, P: DataProvider<M> + ?Sized,

Available on target_has_atomic="ptr" only.
§

fn load(&self, req: DataRequest<'_>) -> Result<DataResponse<M>, DataError>

Query the provider for data, returning the result. Read more
§

impl<DB> Database for Arc<DB>
where DB: Database,

§

type TX = <DB as Database>::TX

Read-Only database transaction
§

type TXMut = <DB as Database>::TXMut

Read-Write database transaction
§

fn tx(&self) -> Result<<Arc<DB> as Database>::TX, DatabaseError>

Create read only transaction.
§

fn tx_mut(&self) -> Result<<Arc<DB> as Database>::TXMut, DatabaseError>

Create read write transaction only possible if database is open with write access.
§

fn view<T, F>(&self, f: F) -> Result<T, DatabaseError>
where F: FnOnce(&Self::TX) -> T,

Takes a function and passes a read-only transaction into it, making sure it’s closed in the end of the execution.
§

fn update<T, F>(&self, f: F) -> Result<T, DatabaseError>
where F: FnOnce(&Self::TXMut) -> T,

Takes a function and passes a write-read transaction into it, making sure it’s committed in the end of the execution.
§

impl<DB> DatabaseMetadata for Arc<DB>
where DB: DatabaseMetadata,

§

fn metadata(&self) -> DatabaseMetadataValue

Returns a metadata type, [DatabaseMetadataValue] for the database.
§

impl<DB> DatabaseMetrics for Arc<DB>
where DB: DatabaseMetrics,

§

fn report_metrics(&self)

Reports metrics for the database.
§

fn gauge_metrics(&self) -> Vec<(&'static str, f64, Vec<Label>)>

Returns a list of Gauge metrics for the database.
§

fn counter_metrics(&self) -> Vec<(&'static str, u64, Vec<Label>)>

Returns a list of Counter metrics for the database.
§

fn histogram_metrics(&self) -> Vec<(&'static str, f64, Vec<Label>)>

Returns a list of Histogram metrics for the database.
Source§

impl<T> DatabaseProviderFactory for Arc<T>

Source§

type DB = <T as DatabaseProviderFactory>::DB

Database this factory produces providers for.
Source§

type Provider = <T as DatabaseProviderFactory>::Provider

Provider type returned by the factory.
Source§

type ProviderRW = <T as DatabaseProviderFactory>::ProviderRW

Read-write provider type returned by the factory.
Source§

fn database_provider_ro( &self, ) -> Result<<Arc<T> as DatabaseProviderFactory>::Provider, ProviderError>

Create new read-only database provider.
Source§

fn database_provider_rw( &self, ) -> Result<<Arc<T> as DatabaseProviderFactory>::ProviderRW, ProviderError>

Create new read-write database provider.
§

impl<T> DatabaseRef for Arc<T>
where T: DatabaseRef + ?Sized,

§

type Error = <T as DatabaseRef>::Error

The database error type.
§

fn basic_ref( &self, address: Address, ) -> Result<Option<AccountInfo>, <Arc<T> as DatabaseRef>::Error>

Get basic account information.
§

fn code_by_hash_ref( &self, code_hash: FixedBytes<32>, ) -> Result<Bytecode, <Arc<T> as DatabaseRef>::Error>

Get account code by its hash.
§

fn storage_ref( &self, address: Address, index: Uint<256, 4>, ) -> Result<Uint<256, 4>, <Arc<T> as DatabaseRef>::Error>

Get storage value of address at index.
§

fn block_hash_ref( &self, number: u64, ) -> Result<FixedBytes<32>, <Arc<T> as DatabaseRef>::Error>

Get block hash by block number.
1.0.0 · Source§

impl<T, A> Debug for Arc<T, A>
where T: Debug + ?Sized, A: Allocator,

Source§

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

Formats the value using the given formatter. Read more
§

impl<T> Decodable for Arc<T>
where T: Decodable,

§

fn decode(buf: &mut &[u8]) -> Result<Arc<T>, Error>

Decodes the blob into the appropriate type. buf must be advanced past the decoded object.
§

impl<T> Decode for Arc<T>
where T: Decode,

§

fn is_ssz_fixed_len() -> bool

Returns true if this object has a fixed-length. Read more
§

fn ssz_fixed_len() -> usize

The number of bytes this object occupies in the fixed-length portion of the SSZ bytes. Read more
§

fn from_ssz_bytes(bytes: &[u8]) -> Result<Arc<T>, DecodeError>

Attempts to decode Self from bytes, returning a DecodeError on failure. Read more
1.0.0 · Source§

impl<T> Default for Arc<T>
where T: Default,

Available on non-no_global_oom_handling only.
Source§

fn default() -> Arc<T>

Creates a new Arc<T>, with the Default value for T.

§Examples
use std::sync::Arc;

let x: Arc<i32> = Default::default();
assert_eq!(*x, 0);
1.0.0 · Source§

impl<T, A> Deref for Arc<T, A>
where A: Allocator, T: ?Sized,

Source§

type Target = T

The resulting type after dereferencing.
Source§

fn deref(&self) -> &T

Dereferences the value.
Source§

impl<'de, T> Deserialize<'de> for Arc<T>
where Box<T>: Deserialize<'de>, T: ?Sized,

Available on crate feature 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>,

Deserialize this value from the given Serde deserializer. Read more
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.
Source§

fn deserialize_as<D>( deserializer: D, ) -> Result<Arc<T>, <D as Deserializer<'de>>::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer.
1.0.0 · Source§

impl<T, A> Display for Arc<T, A>
where T: Display + ?Sized, A: Allocator,

Source§

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

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

impl<T, A> Drop for Arc<T, A>
where A: Allocator, T: ?Sized,

Source§

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.
§

fn load_data( &self, key: DataKey, req: DataRequest<'_>, ) -> Result<DataResponse<M>, DataError>

Query the provider for data, returning the result. Read more
§

impl<T> Encodable for Arc<T>
where T: Encodable + ?Sized,

§

fn length(&self) -> usize

Returns the length of the encoding of this type in bytes. Read more
§

fn encode(&self, out: &mut dyn BufMut)

Encodes the type into the out buffer.
§

impl<T> Encode for Arc<T>
where T: Encode,

§

fn is_ssz_fixed_len() -> bool

Returns true if this object has a fixed-length. Read more
§

fn ssz_fixed_len() -> usize

The number of bytes this object occupies in the fixed-length portion of the SSZ bytes. Read more
§

fn ssz_append(&self, buf: &mut Vec<u8>)

Append the encoding self to buf. Read more
§

fn ssz_bytes_len(&self) -> usize

Returns the size (in bytes) when self is serialized. Read more
§

fn as_ssz_bytes(&self) -> Vec<u8>

Returns the full-form encoding of this object. Read more
1.52.0 · Source§

impl<T> Error for Arc<T>
where T: Error + ?Sized,

Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0: use the Display impl or to_string()
Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting
Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
Source§

fn provide<'a>(&'a self, req: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access #99301)
Provides type-based access to context intended for error reports. Read more
§

impl<T> EthChainSpec for Arc<T>
where T: EthChainSpec + ?Sized, Arc<T>: Send + Sync + Unpin + Debug,

§

type Header = <T as EthChainSpec>::Header

The header type of the network.
§

fn chain(&self) -> Chain

Returns the [Chain] object this spec targets.
§

fn chain_id(&self) -> u64

Returns the chain id number
§

fn base_fee_params_at_block(&self, block_number: u64) -> BaseFeeParams

Get the [BaseFeeParams] for the chain at the given block.
§

fn base_fee_params_at_timestamp(&self, timestamp: u64) -> BaseFeeParams

Get the [BaseFeeParams] for the chain at the given timestamp.
§

fn deposit_contract(&self) -> Option<&DepositContract>

Returns the deposit contract data for the chain, if it’s present
§

fn genesis_hash(&self) -> FixedBytes<32>

The genesis hash.
§

fn prune_delete_limit(&self) -> usize

The delete limit for pruner, per run.
§

fn display_hardforks(&self) -> Box<dyn Display>

Returns a string representation of the hardforks.
§

fn genesis_header(&self) -> &<Arc<T> as EthChainSpec>::Header

The genesis header.
§

fn genesis(&self) -> &Genesis

The genesis block specification.
§

fn bootnodes(&self) -> Option<Vec<NodeRecord>>

The bootnodes for the chain, if any.
§

fn is_optimism(&self) -> bool

Returns true if this chain contains Optimism configuration.
§

fn is_ethereum(&self) -> bool

Returns true if this chain contains Ethereum configuration.
§

impl<T> EthereumHardforks for Arc<T>
where T: EthereumHardforks + ?Sized, Arc<T>: Clone,

§

fn ethereum_fork_activation(&self, fork: EthereumHardfork) -> ForkCondition

Retrieves [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

Convenience method to check if an [EthereumHardfork] is active at a given timestamp.
§

fn is_ethereum_fork_active_at_block( &self, fork: EthereumHardfork, block_number: u64, ) -> bool

Convenience method to check if an [EthereumHardfork] is active at a given block number.
§

fn is_shanghai_active_at_timestamp(&self, timestamp: u64) -> bool

Convenience method to check if [EthereumHardfork::Shanghai] is active at a given timestamp.
§

fn is_cancun_active_at_timestamp(&self, timestamp: u64) -> bool

Convenience method to check if [EthereumHardfork::Cancun] is active at a given timestamp.
§

fn is_prague_active_at_timestamp(&self, timestamp: u64) -> bool

Convenience method to check if [EthereumHardfork::Prague] is active at a given timestamp.
§

fn is_osaka_active_at_timestamp(&self, timestamp: u64) -> bool

Convenience method to check if [EthereumHardfork::Osaka] is active at a given timestamp.
§

fn is_byzantium_active_at_block(&self, block_number: u64) -> bool

Convenience method to check if [EthereumHardfork::Byzantium] is active at a given block number.
§

fn is_spurious_dragon_active_at_block(&self, block_number: u64) -> bool

Convenience method to check if [EthereumHardfork::SpuriousDragon] is active at a given block number.
§

fn is_homestead_active_at_block(&self, block_number: u64) -> bool

Convenience method to check if [EthereumHardfork::Homestead] is active at a given block number.
§

fn is_london_active_at_block(&self, block_number: u64) -> bool

Convenience method to check if [EthereumHardfork::London] is active at a given block number.
§

fn is_constantinople_active_at_block(&self, block_number: u64) -> bool

Convenience method to check if [EthereumHardfork::Constantinople] is active at a given block number.
§

fn is_paris_active_at_block(&self, block_number: u64) -> Option<bool>

The Paris hardfork (merge) is activated via block number. If we have knowledge of the block, this function will return true if the block number is greater than or equal to the Paris (merge) block.
§

fn get_final_paris_total_difficulty(&self) -> Option<Uint<256, 4>>

Returns the final total difficulty if the Paris hardfork is known.
§

fn final_paris_total_difficulty( &self, block_number: u64, ) -> Option<Uint<256, 4>>

Returns the final total difficulty if the given block number is after the Paris hardfork. Read more
1.21.0 · Source§

impl<T, A> From<Box<T, A>> for Arc<T, A>
where A: Allocator, T: ?Sized,

Available on non-no_global_oom_handling only.
Source§

fn from(v: Box<T, A>) -> Arc<T, A>

Move a boxed object to a new, reference-counted allocation.

§Example
let unique: Box<str> = Box::from("eggplant");
let shared: Arc<str> = Arc::from(unique);
assert_eq!("eggplant", &shared[..]);
1.45.0 · Source§

impl<'a, B> From<Cow<'a, B>> for Arc<B>
where B: ToOwned + ?Sized, Arc<B>: From<&'a B> + From<<B as ToOwned>::Owned>,

Source§

fn from(cow: Cow<'a, B>) -> Arc<B>

Creates an atomically reference-counted pointer from a clone-on-write pointer by copying its content.

§Example
let cow: Cow<'_, str> = Cow::Borrowed("eggplant");
let shared: Arc<str> = Arc::from(cow);
assert_eq!("eggplant", &shared[..]);
1.6.0 · Source§

impl<T> From<T> for Arc<T>

Available on non-no_global_oom_handling only.
Source§

fn from(t: T) -> Arc<T>

Converts a T into an Arc<T>

The conversion moves the value into a newly allocated Arc. It is equivalent to calling Arc::new(t).

§Example
let x = 5;
let arc = Arc::new(5);

assert_eq!(Arc::from(x), arc);
§

impl<T> FromHex for Arc<T>
where T: FromHex,

Available on crate feature alloc only.
§

type Error = <T as FromHex>::Error

The associated error which can be returned from parsing.
§

fn from_hex<U>(hex: U) -> Result<Arc<T>, <Arc<T> as FromHex>::Error>
where U: AsRef<[u8]>,

Creates an instance of type Self from the given hex string, or fails with a custom error type. Read more
§

impl<N, T> FullConsensus<N> for Arc<T>
where N: NodePrimitives, T: FullConsensus<N> + ?Sized, Arc<T>: AsConsensus<<N as NodePrimitives>::BlockHeader, <N as NodePrimitives>::BlockBody>,

§

fn validate_block_post_execution( &self, block: &BlockWithSenders<<N as NodePrimitives>::Block>, input: PostExecutionInput<'_, <N as NodePrimitives>::Receipt>, ) -> Result<(), ConsensusError>

Validate a block considering world state, i.e. things that can not be checked before execution. Read more
§

impl<T> GaugeFn for Arc<T>
where T: GaugeFn,

§

fn increment(&self, value: f64)

Increments the gauge by the given amount.
§

fn decrement(&self, value: f64)

Decrements the gauge by the given amount.
§

fn set(&self, value: f64)

Sets the gauge to the given amount.
§

impl<T> Hardforks for Arc<T>
where T: Hardforks + ?Sized, Arc<T>: Clone,

§

fn fork<H>(&self, fork: H) -> ForkCondition
where H: Hardfork,

Retrieves [ForkCondition] from fork. If fork is not present, returns [ForkCondition::Never].
§

fn forks_iter( &self, ) -> impl Iterator<Item = (&(dyn Hardfork + 'static), ForkCondition)>

Get an iterator of all hardforks with their respective activation conditions.
§

fn is_fork_active_at_timestamp<H>(&self, fork: H, timestamp: u64) -> bool
where H: Hardfork,

Convenience method to check if a fork is active at a given timestamp.
§

fn is_fork_active_at_block<H>(&self, fork: H, block_number: u64) -> bool
where H: Hardfork,

Convenience method to check if a fork is active at a given block number.
§

fn fork_id(&self, head: &Head) -> ForkId

Compute the [ForkId] for the given [Head] following eip-6122 spec
§

fn latest_fork_id(&self) -> ForkId

Returns the [ForkId] for the last fork.
§

fn fork_filter(&self, head: Head) -> ForkFilter

Creates a [ForkFilter] for the block described by [Head].
1.0.0 · Source§

impl<T, A> Hash for Arc<T, A>
where T: Hash + ?Sized, A: Allocator,

Source§

fn hash<H>(&self, state: &mut H)
where H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<T> HashedPostStateProvider for Arc<T>

Source§

fn hashed_post_state(&self, bundle_state: &BundleState) -> HashedPostState

Returns the HashedPostState of the provided BundleState.
Source§

impl<T> HashingWriter for Arc<T>
where T: HashingWriter + ?Sized, Arc<T>: Send + Sync,

Source§

fn unwind_account_hashing<'a>( &self, changesets: impl Iterator<Item = &'a (u64, AccountBeforeTx)>, ) -> Result<BTreeMap<FixedBytes<32>, Option<Account>>, ProviderError>

Unwind and clear account hashing. Read more
Source§

fn unwind_account_hashing_range( &self, range: impl RangeBounds<u64>, ) -> Result<BTreeMap<FixedBytes<32>, Option<Account>>, ProviderError>

Unwind and clear account hashing in a given block range. Read more
Source§

fn insert_account_for_hashing( &self, accounts: impl IntoIterator<Item = (Address, Option<Account>)>, ) -> Result<BTreeMap<FixedBytes<32>, Option<Account>>, ProviderError>

Inserts all accounts into [reth_db::tables::AccountsHistory] table. Read more
Source§

fn unwind_storage_hashing( &self, changesets: impl Iterator<Item = (BlockNumberAddress, StorageEntry)>, ) -> Result<HashMap<FixedBytes<32>, BTreeSet<FixedBytes<32>>, RandomState>, ProviderError>

Unwind and clear storage hashing Read more
Source§

fn unwind_storage_hashing_range( &self, range: impl RangeBounds<BlockNumberAddress>, ) -> Result<HashMap<FixedBytes<32>, BTreeSet<FixedBytes<32>>, RandomState>, ProviderError>

Unwind and clear storage hashing in a given block range. Read more
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>

Iterates over storages and inserts them to hashing table. Read more
Source§

fn insert_hashes( &self, range: RangeInclusive<u64>, end_block_hash: FixedBytes<32>, expected_state_root: FixedBytes<32>, ) -> Result<(), ProviderError>

Calculate the hashes of all changed accounts and storages, and finally calculate the state root. Read more
Source§

impl<T> HeaderProvider for Arc<T>
where T: HeaderProvider + ?Sized, Arc<T>: Send + Sync,

Source§

type Header = <T as HeaderProvider>::Header

The header type this provider supports.
Source§

fn is_known(&self, block_hash: &FixedBytes<32>) -> Result<bool, ProviderError>

Check if block is known
Source§

fn header( &self, block_hash: &FixedBytes<32>, ) -> Result<Option<<Arc<T> as HeaderProvider>::Header>, ProviderError>

Get header by block hash
Source§

fn sealed_header_by_hash( &self, block_hash: FixedBytes<32>, ) -> Result<Option<SealedHeader<<Arc<T> as HeaderProvider>::Header>>, ProviderError>

Retrieves the header sealed by the given block hash.
Source§

fn header_by_number( &self, num: u64, ) -> Result<Option<<Arc<T> as HeaderProvider>::Header>, ProviderError>

Get header by block number
Source§

fn header_by_hash_or_number( &self, hash_or_num: HashOrNumber, ) -> Result<Option<<Arc<T> as HeaderProvider>::Header>, ProviderError>

Get header by block number or hash
Source§

fn header_td( &self, hash: &FixedBytes<32>, ) -> Result<Option<Uint<256, 4>>, ProviderError>

Get total difficulty by block hash.
Source§

fn header_td_by_number( &self, number: u64, ) -> Result<Option<Uint<256, 4>>, ProviderError>

Get total difficulty by block number.
Source§

fn headers_range( &self, range: impl RangeBounds<u64>, ) -> Result<Vec<<Arc<T> as HeaderProvider>::Header>, ProviderError>

Get headers in range of block numbers
Source§

fn sealed_header( &self, number: u64, ) -> Result<Option<SealedHeader<<Arc<T> as HeaderProvider>::Header>>, ProviderError>

Get a single sealed header by block number.
Source§

fn sealed_headers_range( &self, range: impl RangeBounds<u64>, ) -> Result<Vec<SealedHeader<<Arc<T> as HeaderProvider>::Header>>, ProviderError>

Get headers in range of block numbers.
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>

Get sealed headers while predicate returns true or the range is exhausted.
§

impl<H, T> HeaderValidator<H> for Arc<T>
where T: HeaderValidator<H> + ?Sized, Arc<T>: Debug + Send + Sync,

§

fn validate_header( &self, header: &SealedHeader<H>, ) -> Result<(), ConsensusError>

Validate if header is correct and follows consensus specification. Read more
§

fn validate_header_against_parent( &self, header: &SealedHeader<H>, parent: &SealedHeader<H>, ) -> Result<(), ConsensusError>

Validate that the header information regarding parent are correct. This checks the block number, timestamp, basefee and gas limit increment. Read more
§

fn validate_header_range( &self, headers: &[SealedHeader<H>], ) -> Result<(), HeaderConsensusError<H>>
where H: Clone,

Validates the given headers Read more
§

fn validate_header_with_total_difficulty( &self, header: &H, total_difficulty: Uint<256, 4>, ) -> Result<(), ConsensusError>

Validate if the header is correct and follows the consensus specification, including computed properties (like total difficulty). Read more
§

impl<T> HistogramFn for Arc<T>
where T: HistogramFn,

§

fn record(&self, value: f64)

Records a value into the histogram.
§

fn record_many(&self, value: f64, count: usize)

Records a value into the histogram multiple times.
Source§

impl<T> HistoryWriter for Arc<T>
where T: HistoryWriter + ?Sized, Arc<T>: Send + Sync,

Source§

fn unwind_account_history_indices<'a>( &self, changesets: impl Iterator<Item = &'a (u64, AccountBeforeTx)>, ) -> Result<usize, ProviderError>

Unwind and clear account history indices. Read more
Source§

fn unwind_account_history_indices_range( &self, range: impl RangeBounds<u64>, ) -> Result<usize, ProviderError>

Unwind and clear account history indices in a given block range. Read more
Source§

fn insert_account_history_index( &self, index_updates: impl IntoIterator<Item = (Address, impl IntoIterator<Item = u64>)>, ) -> Result<(), ProviderError>

Insert account change index to database. Used inside AccountHistoryIndex stage
Source§

fn unwind_storage_history_indices( &self, changesets: impl Iterator<Item = (BlockNumberAddress, StorageEntry)>, ) -> Result<usize, ProviderError>

Unwind and clear storage history indices. Read more
Source§

fn unwind_storage_history_indices_range( &self, range: impl RangeBounds<BlockNumberAddress>, ) -> Result<usize, ProviderError>

Unwind and clear storage history indices in a given block range. Read more
Source§

fn insert_storage_history_index( &self, storage_transitions: impl IntoIterator<Item = ((Address, FixedBytes<32>), impl IntoIterator<Item = u64>)>, ) -> Result<(), ProviderError>

Insert storage change index to database. Used inside StorageHistoryIndex stage
Source§

fn update_history_indices( &self, range: RangeInclusive<u64>, ) -> Result<(), ProviderError>

Read account/storage changesets and update account/storage history indices.
§

impl<T> InMemorySize for Arc<T>
where T: InMemorySize + ?Sized,

§

fn size(&self) -> usize

Returns a heuristic for the in-memory size of a struct.
§

impl<Sp> LocalSpawn for Arc<Sp>
where Sp: LocalSpawn + ?Sized,

§

fn spawn_local_obj( &self, future: LocalFutureObj<'static, ()>, ) -> Result<(), SpawnError>

Spawns a future that will be run to completion. Read more
§

fn status_local(&self) -> Result<(), SpawnError>

Determines whether the executor is able to spawn new tasks. Read more
§

impl<'a, W> MakeWriter<'a> for Arc<W>
where &'a W: Write + 'a,

§

type Writer = &'a W

The concrete io::Write implementation returned by make_writer.
§

fn make_writer(&'a self) -> <Arc<W> as MakeWriter<'a>>::Writer

Returns an instance of Writer. Read more
§

fn make_writer_for(&'a self, meta: &Metadata<'_>) -> Self::Writer

Returns a Writer for writing data from the span or event described by the provided Metadata. Read more
§

impl<N, T> NetworkWallet<N> for Arc<T>
where N: Network, T: NetworkWallet<N> + ?Sized, Arc<T>: Debug + Send + Sync,

§

fn default_signer_address(&self) -> Address

Get the default signer address. This address should be used in [NetworkWallet::sign_transaction_from] when no specific signer is specified.
§

fn has_signer_for(&self, address: &Address) -> bool

Return true if the signer contains a credential for the given address.
§

fn signer_addresses(&self) -> impl Iterator<Item = Address>

Return an iterator of all signer addresses.
§

fn sign_transaction_from( &self, sender: Address, tx: <N as Network>::UnsignedTx, ) -> impl Send + Future<Output = Result<<N as Network>::TxEnvelope, Error>>

Asynchronously sign an unsigned transaction, with a specified credential.
§

fn sign_transaction( &self, tx: <N as Network>::UnsignedTx, ) -> impl Send + Future<Output = Result<<N as Network>::TxEnvelope, Error>>

Asynchronously sign an unsigned transaction.
§

fn sign_request( &self, request: <N as Network>::TransactionRequest, ) -> impl Send + Future<Output = Result<<N as Network>::TxEnvelope, Error>>

Asynchronously sign a transaction request, using the sender specified in the from field.
Source§

impl<T> NodePrimitivesProvider for Arc<T>

Source§

type Primitives = <T as NodePrimitivesProvider>::Primitives

The node primitive types.
Source§

impl<T> OmmersProvider for Arc<T>
where T: OmmersProvider,

Source§

fn ommers( &self, id: HashOrNumber, ) -> Result<Option<Vec<<Arc<T> as HeaderProvider>::Header>>, ProviderError>

Returns the ommers/uncle headers of the given block from the database. Read more
1.0.0 · Source§

impl<T, A> Ord for Arc<T, A>
where T: Ord + ?Sized, A: Allocator,

Source§

fn cmp(&self, other: &Arc<T, A>) -> Ordering

Comparison for two Arcs.

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) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
1.0.0 · Source§

impl<T, A> PartialEq for Arc<T, A>
where T: PartialEq + ?Sized, A: Allocator,

Source§

fn eq(&self, other: &Arc<T, A>) -> bool

Equality for two Arcs.

Two Arcs 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 Arcs 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

Inequality for two Arcs.

Two Arcs are not equal if their inner values are not equal.

If T also implements Eq (implying reflexivity of equality), two Arcs 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>
where T: PartialOrd + ?Sized, A: Allocator,

Source§

fn partial_cmp(&self, other: &Arc<T, A>) -> Option<Ordering>

Partial comparison for two Arcs.

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

Less-than comparison for two Arcs.

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

‘Less than or equal to’ comparison for two Arcs.

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§

fn gt(&self, other: &Arc<T, A>) -> bool

Greater-than comparison for two Arcs.

The two are compared by calling > on their inner values.

§Examples
use std::sync::Arc;

let five = Arc::new(5);

assert!(five > Arc::new(4));
Source§

fn ge(&self, other: &Arc<T, A>) -> bool

‘Greater than or equal to’ comparison for two Arcs.

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));
1.0.0 · Source§

impl<T, A> Pointer for Arc<T, A>
where A: Allocator, T: ?Sized,

Source§

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

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

impl<T> PruneCheckpointReader for Arc<T>

Source§

fn get_prune_checkpoint( &self, segment: PruneSegment, ) -> Result<Option<PruneCheckpoint>, ProviderError>

Fetch the prune checkpoint for the given segment.
Source§

fn get_prune_checkpoints( &self, ) -> Result<Vec<(PruneSegment, PruneCheckpoint)>, ProviderError>

Fetch all the prune checkpoints.
Source§

impl<T> PruneCheckpointWriter for Arc<T>

Source§

fn save_prune_checkpoint( &self, segment: PruneSegment, checkpoint: PruneCheckpoint, ) -> Result<(), ProviderError>

Save prune checkpoint.
Source§

impl<T> ReceiptProvider for Arc<T>
where T: ReceiptProvider + ?Sized, Arc<T>: Send + Sync,

Source§

type Receipt = <T as ReceiptProvider>::Receipt

The receipt type.
Source§

fn receipt( &self, id: u64, ) -> Result<Option<<Arc<T> as ReceiptProvider>::Receipt>, ProviderError>

Get receipt by transaction number Read more
Source§

fn receipt_by_hash( &self, hash: FixedBytes<32>, ) -> Result<Option<<Arc<T> as ReceiptProvider>::Receipt>, ProviderError>

Get receipt by transaction hash. Read more
Source§

fn receipts_by_block( &self, block: HashOrNumber, ) -> Result<Option<Vec<<Arc<T> as ReceiptProvider>::Receipt>>, ProviderError>

Get receipts by block num or hash. Read more
Source§

fn receipts_by_tx_range( &self, range: impl RangeBounds<u64>, ) -> Result<Vec<<Arc<T> as ReceiptProvider>::Receipt>, ProviderError>

Get receipts by tx range.
§

impl<T> Recorder for Arc<T>
where T: Recorder + ?Sized,

§

fn describe_counter( &self, key: KeyName, unit: Option<Unit>, description: Cow<'static, str>, )

Describes a counter. Read more
§

fn describe_gauge( &self, key: KeyName, unit: Option<Unit>, description: Cow<'static, str>, )

Describes a gauge. Read more
§

fn describe_histogram( &self, key: KeyName, unit: Option<Unit>, description: Cow<'static, str>, )

Describes a histogram. Read more
§

fn register_counter(&self, key: &Key, metadata: &Metadata<'_>) -> Counter

Registers a counter.
§

fn register_gauge(&self, key: &Key, metadata: &Metadata<'_>) -> Gauge

Registers a gauge.
§

fn register_histogram(&self, key: &Key, metadata: &Metadata<'_>) -> Histogram

Registers a histogram.
Source§

impl<T> Serialize for Arc<T>
where T: Serialize + ?Sized,

Available on crate feature 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,

Serialize this value into the given Serde serializer. Read more
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.
Source§

fn serialize_as<S>( source: &Arc<T>, serializer: S, ) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>
where S: Serializer,

Serialize this value into the given Serde serializer.
§

impl<T> SignedTransaction for Arc<T>
where T: SignedTransaction + ?Sized, Arc<T>: Send + Sync + Unpin + Clone + Debug + PartialEq + Eq + Hash + Encodable + Decodable + Encodable2718 + Decodable2718 + Transaction + MaybeSerde + InMemorySize,

§

fn tx_hash(&self) -> &FixedBytes<32>

Returns reference to transaction hash.
§

fn signature(&self) -> &PrimitiveSignature

Returns reference to signature.
§

fn is_broadcastable_in_full(&self) -> bool

Returns whether this transaction type can be broadcasted as full transaction over the network. Read more
§

fn recover_signer(&self) -> Option<Address>

Recover signer from signature and hash. Read more
§

fn recover_signer_unchecked(&self) -> Option<Address>

Recover signer from signature and hash without ensuring that the signature has a low s value. Read more
§

fn recover_signer_unchecked_with_buf( &self, buf: &mut Vec<u8>, ) -> Option<Address>

Same as [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>

Calculate transaction hash, eip2728 transaction does not contain rlp header and start with tx type.
§

impl<Sig, U> SignerSync<Sig> for Arc<U>
where U: SignerSync<Sig> + ?Sized,

§

fn sign_hash_sync(&self, hash: &FixedBytes<32>) -> Result<Sig, Error>

Signs the given hash.
§

fn sign_message_sync(&self, message: &[u8]) -> Result<Sig, Error>

Signs the hash of the provided message after prefixing it, as specified in EIP-191.
§

fn chain_id_sync(&self) -> Option<u64>

Returns the signer’s chain ID.
§

impl<Sp> Spawn for Arc<Sp>
where Sp: Spawn + ?Sized,

§

fn spawn_obj(&self, future: FutureObj<'static, ()>) -> Result<(), SpawnError>

Spawns a future that will be run to completion. Read more
§

fn status(&self) -> Result<(), SpawnError>

Determines whether the executor is able to spawn new tasks. Read more
Source§

impl<T> StageCheckpointReader for Arc<T>

Source§

fn get_stage_checkpoint( &self, id: StageId, ) -> Result<Option<StageCheckpoint>, ProviderError>

Fetch the checkpoint for the given stage.
Source§

fn get_stage_checkpoint_progress( &self, id: StageId, ) -> Result<Option<Vec<u8>>, ProviderError>

Get stage checkpoint progress.
Source§

fn get_all_checkpoints( &self, ) -> Result<Vec<(String, StageCheckpoint)>, ProviderError>

Reads all stage checkpoints and returns a list with the name of the stage and the checkpoint data.
Source§

impl<T> StageCheckpointWriter for Arc<T>

Source§

fn save_stage_checkpoint( &self, id: StageId, checkpoint: StageCheckpoint, ) -> Result<(), ProviderError>

Save stage checkpoint.
Source§

fn save_stage_checkpoint_progress( &self, id: StageId, checkpoint: Vec<u8>, ) -> Result<(), ProviderError>

Save stage checkpoint progress.
Source§

fn update_pipeline_stages( &self, block_number: u64, drop_stage_checkpoint: bool, ) -> Result<(), ProviderError>

Update all pipeline sync stage progress.
§

impl<T> State for Arc<T>
where T: StateRef,

§

type Error = <T as StateRef>::Error

§

fn basic( &mut self, address: Address, ) -> Result<Option<AccountInfo>, <Arc<T> as State>::Error>

Get basic account information.
§

fn code_by_hash( &mut self, code_hash: FixedBytes<32>, ) -> Result<Bytecode, <Arc<T> as State>::Error>

Get account code by its hash
§

fn storage( &mut self, address: Address, index: Uint<256, 4>, ) -> Result<Uint<256, 4>, <Arc<T> as State>::Error>

Get storage value of address at index.
Source§

impl<T> StateProofProvider for Arc<T>
where T: StateProofProvider + ?Sized, Arc<T>: Send + Sync,

Source§

fn proof( &self, input: TrieInput, address: Address, slots: &[FixedBytes<32>], ) -> Result<AccountProof, ProviderError>

Get account and storage proofs of target keys in the 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>

Generate [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>

Get trie witness for provided state.
Source§

impl<T> StateProvider for Arc<T>

Source§

fn storage( &self, account: Address, storage_key: FixedBytes<32>, ) -> Result<Option<Uint<256, 4>>, ProviderError>

Get storage of given account.
Source§

fn bytecode_by_hash( &self, code_hash: &FixedBytes<32>, ) -> Result<Option<Bytecode>, ProviderError>

Get account code by its hash
Source§

fn account_code( &self, addr: &Address, ) -> Result<Option<Bytecode>, ProviderError>

Get account code by its address. Read more
Source§

fn account_balance( &self, addr: &Address, ) -> Result<Option<Uint<256, 4>>, ProviderError>

Get account balance by its address. Read more
Source§

fn account_nonce(&self, addr: &Address) -> Result<Option<u64>, ProviderError>

Get account nonce by its address. Read more
Source§

impl<T> StateProviderFactory for Arc<T>

Source§

fn latest(&self) -> Result<Box<dyn StateProvider>, ProviderError>

Storage provider for latest block.
Source§

fn state_by_block_id( &self, block_id: BlockId, ) -> Result<Box<dyn StateProvider>, ProviderError>

Returns a StateProvider indexed by the given [BlockId]. Read more
Source§

fn state_by_block_number_or_tag( &self, number_or_tag: BlockNumberOrTag, ) -> Result<Box<dyn StateProvider>, ProviderError>

Returns a StateProvider indexed by the given block number or tag. Read more
Source§

fn history_by_block_number( &self, block: u64, ) -> Result<Box<dyn StateProvider>, ProviderError>

Returns a historical StateProvider indexed by the given historic block number. Read more
Source§

fn history_by_block_hash( &self, block: FixedBytes<32>, ) -> Result<Box<dyn StateProvider>, ProviderError>

Returns a historical StateProvider indexed by the given block hash. Read more
Source§

fn state_by_block_hash( &self, block: FixedBytes<32>, ) -> Result<Box<dyn StateProvider>, ProviderError>

Returns any StateProvider with matching block hash. Read more
Source§

fn pending(&self) -> Result<Box<dyn StateProvider>, ProviderError>

Storage provider for pending state. Read more
Source§

fn pending_state_by_hash( &self, block_hash: FixedBytes<32>, ) -> Result<Option<Box<dyn StateProvider>>, ProviderError>

Storage provider for pending state for the given block hash. Read more
§

impl<T> StateRef for Arc<T>
where T: StateRef + ?Sized,

§

type Error = <T as StateRef>::Error

§

fn basic( &self, address: Address, ) -> Result<Option<AccountInfo>, <Arc<T> as StateRef>::Error>

Get basic account information.
§

fn code_by_hash( &self, code_hash: FixedBytes<32>, ) -> Result<Bytecode, <Arc<T> as StateRef>::Error>

Get account code by its hash
§

fn storage( &self, address: Address, index: Uint<256, 4>, ) -> Result<Uint<256, 4>, <Arc<T> as StateRef>::Error>

Get storage value of address at index.
Source§

impl<T> StateRootProvider for Arc<T>
where T: StateRootProvider + ?Sized, Arc<T>: Send + Sync,

Source§

fn state_root( &self, hashed_state: HashedPostState, ) -> Result<FixedBytes<32>, ProviderError>

Returns the state root of the BundleState on top of the current state. Read more
Source§

fn state_root_from_nodes( &self, input: TrieInput, ) -> Result<FixedBytes<32>, ProviderError>

Returns the state root of the 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>

Returns the state root of the 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>

Returns state root and trie updates. See StateRootProvider::state_root_from_nodes for more info.
Source§

impl<U> StatsReader for Arc<U>
where U: StatsReader + ?Sized, Arc<U>: Send + Sync,

Source§

fn count_entries<T>(&self) -> Result<usize, ProviderError>
where T: Table,

Fetch the number of entries in the corresponding [Table]. Depending on the provider, it may route to different data sources other than [Table].
Source§

impl<T> StorageChangeSetReader for Arc<T>

Source§

fn storage_changeset( &self, block_number: u64, ) -> Result<Vec<(BlockNumberAddress, StorageEntry)>, ProviderError>

Iterate over storage changesets and return the storage state from before this block.
Source§

impl<T> StorageReader for Arc<T>
where T: StorageReader + ?Sized, Arc<T>: Send + Sync,

Source§

fn plain_state_storages( &self, addresses_with_keys: impl IntoIterator<Item = (Address, impl IntoIterator<Item = FixedBytes<32>>)>, ) -> Result<Vec<(Address, Vec<StorageEntry>)>, ProviderError>

Get plainstate storages for addresses and storage keys.
Source§

fn changed_storages_with_range( &self, range: RangeInclusive<u64>, ) -> Result<BTreeMap<Address, BTreeSet<FixedBytes<32>>>, ProviderError>

Iterate over storage changesets and return all storage slots that were changed.
Source§

fn changed_storages_and_blocks_with_range( &self, range: RangeInclusive<u64>, ) -> Result<BTreeMap<(Address, FixedBytes<32>), Vec<u64>>, ProviderError>

Iterate over storage changesets and return all storage slots that were changed alongside each specific set of blocks. Read more
Source§

impl<T> StorageRootProvider for Arc<T>
where T: StorageRootProvider + ?Sized, Arc<T>: Send + Sync,

Source§

fn storage_root( &self, address: Address, hashed_storage: HashedStorage, ) -> Result<FixedBytes<32>, ProviderError>

Returns the storage root of the 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>

Returns the storage proof of the 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>

Returns the storage multiproof for target slots.
Source§

impl<T> StorageTrieWriter for Arc<T>
where T: StorageTrieWriter + ?Sized, Arc<T>: Send + Sync,

Source§

fn write_storage_trie_updates( &self, storage_tries: &HashMap<FixedBytes<32>, StorageTrieUpdates, FbBuildHasher<32>>, ) -> Result<usize, ProviderError>

Writes storage trie updates from the given storage trie map. Read more
Source§

fn write_individual_storage_trie_updates( &self, hashed_address: FixedBytes<32>, updates: &StorageTrieUpdates, ) -> Result<usize, ProviderError>

Writes storage trie updates for the given hashed address.
§

impl<S> Strategy for Arc<S>
where S: Strategy + ?Sized,

§

type Tree = <S as Strategy>::Tree

The value tree generated by this Strategy.
§

type Value = <S as Strategy>::Value

The type of value used by functions under test generated by this Strategy. Read more
§

fn new_tree( &self, runner: &mut TestRunner, ) -> Result<<Arc<S> as Strategy>::Tree, Reason>

Generate a new value tree from the given runner. Read more
§

fn prop_map<O, F>(self, fun: F) -> Map<Self, F>
where O: Debug, F: Fn(Self::Value) -> O, Self: Sized,

Returns a strategy which produces values transformed by the function fun. Read more
§

fn prop_map_into<O>(self) -> MapInto<Self, O>
where O: Debug, Self: Sized, Self::Value: Into<O>,

Returns a strategy which produces values of type O by transforming Self with Into<O>. Read more
§

fn prop_perturb<O, F>(self, fun: F) -> Perturb<Self, F>
where O: Debug, F: Fn(Self::Value, TestRng) -> O, Self: Sized,

Returns a strategy which produces values transformed by the function fun, which is additionally given a random number generator. Read more
§

fn prop_flat_map<S, F>(self, fun: F) -> Flatten<Map<Self, F>>
where S: Strategy, F: Fn(Self::Value) -> S, Self: Sized,

Maps values produced by this strategy into new strategies and picks values from those strategies. Read more
§

fn prop_ind_flat_map<S, F>(self, fun: F) -> IndFlatten<Map<Self, F>>
where S: Strategy, F: Fn(Self::Value) -> S, Self: Sized,

Maps values produced by this strategy into new strategies and picks values from those strategies while considering the new strategies to be independent. Read more
§

fn prop_ind_flat_map2<S, F>(self, fun: F) -> IndFlattenMap<Self, F>
where S: Strategy, F: Fn(Self::Value) -> S, Self: Sized,

Similar to 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>
where R: Into<Reason>, F: Fn(&Self::Value) -> bool, Self: Sized,

Returns a strategy which only produces values accepted by fun. Read more
§

fn prop_filter_map<F, O>( self, whence: impl Into<Reason>, fun: F, ) -> FilterMap<Self, F>
where F: Fn(Self::Value) -> Option<O>, O: Debug, Self: Sized,

Returns a strategy which only produces transformed values where fun returns Some(value) and rejects those where fun returns None. Read more
§

fn prop_union(self, other: Self) -> Union<Self>
where Self: Sized,

Returns a strategy which picks uniformly from self and other. Read more
§

fn prop_recursive<R, F>( self, depth: u32, desired_size: u32, expected_branch_size: u32, recurse: F, ) -> Recursive<Self::Value, F>
where R: Strategy<Value = Self::Value> + 'static, F: Fn(BoxedStrategy<Self::Value>) -> R, Self: Sized + 'static,

Generate a recursive structure with self items as leaves. Read more
§

fn prop_shuffle(self) -> Shuffle<Self>
where Self: Sized, Self::Value: Shuffleable,

Shuffle the contents of the values produced by this strategy. Read more
§

fn boxed(self) -> BoxedStrategy<Self::Value>
where Self: Sized + 'static,

Erases the type of this Strategy so it can be passed around as a simple trait object. Read more
§

fn sboxed(self) -> SBoxedStrategy<Self::Value>
where Self: Sized + Send + Sync + 'static,

Erases the type of this Strategy so it can be passed around as a simple trait object. Read more
§

fn no_shrink(self) -> NoShrink<Self>
where Self: Sized,

Wraps this strategy to prevent values from being subject to shrinking. Read more
§

impl<S> Subscriber for Arc<S>
where S: Subscriber + ?Sized,

§

fn register_callsite(&self, metadata: &'static Metadata<'static>) -> Interest

Registers a new callsite with this subscriber, returning whether or not the subscriber is interested in being notified about the callsite. Read more
§

fn enabled(&self, metadata: &Metadata<'_>) -> bool

Returns true if a span or event with the specified metadata would be recorded. Read more
§

fn max_level_hint(&self) -> Option<LevelFilter>

Returns the highest verbosity level that this Subscriber will enable, or None, if the subscriber does not implement level-based filtering or chooses not to implement this method. Read more
§

fn new_span(&self, span: &Attributes<'_>) -> Id

Visit the construction of a new span, returning a new span ID for the span being constructed. Read more
§

fn record(&self, span: &Id, values: &Record<'_>)

Record a set of values on a span. Read more
§

fn record_follows_from(&self, span: &Id, follows: &Id)

Adds an indication that span follows from the span with the id follows. Read more
§

fn event_enabled(&self, event: &Event<'_>) -> bool

Determine if an [Event] should be recorded. Read more
§

fn event(&self, event: &Event<'_>)

Records that an Event has occurred. Read more
§

fn enter(&self, span: &Id)

Records that a span has been entered. Read more
§

fn exit(&self, span: &Id)

Records that a span has been exited. Read more
§

fn clone_span(&self, id: &Id) -> Id

Notifies the subscriber that a span ID has been cloned. Read more
§

fn try_close(&self, id: Id) -> bool

Notifies the subscriber that a span ID has been dropped, and returns true if there are now 0 IDs that refer to that span. Read more
§

fn drop_span(&self, id: Id)

👎Deprecated since 0.1.2: use Subscriber::try_close instead
This method is deprecated. Read more
§

fn current_span(&self) -> Current

Returns a type representing this subscriber’s view of the current span. Read more
§

unsafe fn downcast_raw(&self, id: TypeId) -> Option<*const ()>

If 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)

Invoked when this subscriber becomes a [Dispatch]. Read more
§

impl<T> Transaction for Arc<T>
where T: Transaction + ?Sized, Arc<T>: Typed2718 + Debug + Any + Send + Sync + 'static,

§

fn chain_id(&self) -> Option<u64>

Get chain_id.
§

fn nonce(&self) -> u64

Get nonce.
§

fn gas_limit(&self) -> u64

Get gas_limit.
§

fn gas_price(&self) -> Option<u128>

Get gas_price.
§

fn max_fee_per_gas(&self) -> u128

Returns the EIP-1559 the maximum fee per gas the caller is willing to pay. Read more
§

fn max_priority_fee_per_gas(&self) -> Option<u128>

Returns the EIP-1559 Priority fee the caller is paying to the block author. Read more
§

fn max_fee_per_blob_gas(&self) -> Option<u128>

Max fee per blob gas for EIP-4844 transaction. Read more
§

fn priority_fee_or_price(&self) -> u128

Return the max priority fee per gas if the transaction is an EIP-1559 transaction, and otherwise return the gas price. Read more
§

fn effective_gas_price(&self, base_fee: Option<u64>) -> u128

Returns the effective gas price for the given base fee. Read more
§

fn effective_tip_per_gas(&self, base_fee: u64) -> Option<u128>

Returns the effective tip for this transaction. Read more
§

fn is_dynamic_fee(&self) -> bool

Returns true if the transaction supports dynamic fees.
§

fn kind(&self) -> TxKind

Returns the transaction kind.
§

fn is_create(&self) -> bool

Returns true if the transaction is a contract creation. We don’t provide a default implementation via kind as it copies the 21-byte TxKind for this simple check. A proper implementation shouldn’t allocate.
§

fn to(&self) -> Option<Address>

Get the transaction’s address of the contract that will be called, or the address that will receive the transfer. Read more
§

fn value(&self) -> Uint<256, 4>

Get value.
§

fn input(&self) -> &Bytes

Get data.
§

fn access_list(&self) -> Option<&AccessList>

Returns the EIP-2930 access_list for the particular transaction type. Returns None for older transaction types.
§

fn blob_versioned_hashes(&self) -> Option<&[FixedBytes<32>]>

Blob versioned hashes for eip4844 transaction. For previous transaction types this is None.
§

fn blob_gas_used(&self) -> Option<u64>

Returns the total gas for all blobs in this transaction. Read more
§

fn authorization_list(&self) -> Option<&[SignedAuthorization]>

Returns the SignedAuthorization list of the transaction. Read more
Source§

impl<T> TransactionsProvider for Arc<T>

Source§

type Transaction = <T as TransactionsProvider>::Transaction

The transaction type this provider reads.
Source§

fn transaction_id( &self, tx_hash: FixedBytes<32>, ) -> Result<Option<u64>, ProviderError>

Get internal transaction identifier by transaction hash. Read more
Source§

fn transaction_by_id( &self, id: u64, ) -> Result<Option<<Arc<T> as TransactionsProvider>::Transaction>, ProviderError>

Get transaction by id, computes hash every time so more expensive.
Source§

fn transaction_by_id_unhashed( &self, id: u64, ) -> Result<Option<<Arc<T> as TransactionsProvider>::Transaction>, ProviderError>

Get transaction by id without computing the hash.
Source§

fn transaction_by_hash( &self, hash: FixedBytes<32>, ) -> Result<Option<<Arc<T> as TransactionsProvider>::Transaction>, ProviderError>

Get transaction by transaction hash.
Source§

fn transaction_by_hash_with_meta( &self, hash: FixedBytes<32>, ) -> Result<Option<(<Arc<T> as TransactionsProvider>::Transaction, TransactionMeta)>, ProviderError>

Get transaction by transaction hash and additional metadata of the block the transaction was mined in
Source§

fn transaction_block(&self, id: u64) -> Result<Option<u64>, ProviderError>

Get transaction block number
Source§

fn transactions_by_block( &self, block: HashOrNumber, ) -> Result<Option<Vec<<Arc<T> as TransactionsProvider>::Transaction>>, ProviderError>

Get transactions by block id.
Source§

fn transactions_by_block_range( &self, range: impl RangeBounds<u64>, ) -> Result<Vec<Vec<<Arc<T> as TransactionsProvider>::Transaction>>, ProviderError>

Get transactions by block range.
Source§

fn transactions_by_tx_range( &self, range: impl RangeBounds<u64>, ) -> Result<Vec<<Arc<T> as TransactionsProvider>::Transaction>, ProviderError>

Get transactions by tx range.
Source§

fn senders_by_tx_range( &self, range: impl RangeBounds<u64>, ) -> Result<Vec<Address>, ProviderError>

Get Senders from a tx range.
Source§

fn transaction_sender(&self, id: u64) -> Result<Option<Address>, ProviderError>

Get transaction sender. Read more
Source§

impl<T> TransactionsProviderExt for Arc<T>

Source§

fn transaction_range_by_block_range( &self, block_range: RangeInclusive<u64>, ) -> Result<RangeInclusive<u64>, ProviderError>

Get transactions range by block range.
Source§

fn transaction_hashes_by_range( &self, tx_range: Range<u64>, ) -> Result<Vec<(FixedBytes<32>, u64)>, ProviderError>

Get transaction hashes from a transaction range.
Source§

impl<T> TrieWriter for Arc<T>
where T: TrieWriter + ?Sized, Arc<T>: Send + Sync,

Source§

fn write_trie_updates( &self, trie_updates: &TrieUpdates, ) -> Result<usize, ProviderError>

Writes trie updates to the database. Read more
§

impl<T> TxReceipt for Arc<T>
where T: TxReceipt + ?Sized, Arc<T>: Clone + Debug + PartialEq + Eq + Send + Sync,

§

type Log = <T as TxReceipt>::Log

The associated log type.
§

fn status_or_post_state(&self) -> Eip658Value

Returns the status or post state of the transaction. Read more
§

fn status(&self) -> bool

Returns true if the transaction was successful OR if the transaction is pre-EIP-658. Results for transactions before EIP-658 are not reliable. Read more
§

fn bloom(&self) -> Bloom

Returns the bloom filter for the logs in the receipt. This operation may be expensive.
§

fn bloom_cheap(&self) -> Option<Bloom>

Returns the bloom filter for the logs in the receipt, if it is cheap to compute.
§

fn cumulative_gas_used(&self) -> u64

Returns the cumulative gas used in the block after this transaction was executed.
§

fn logs(&self) -> &[<Arc<T> as TxReceipt>::Log]

Returns the logs emitted by this transaction.
§

fn with_bloom_ref(&self) -> ReceiptWithBloom<&Self>

Returns [ReceiptWithBloom] with the computed bloom filter [Self::bloom] and a reference to the receipt.
§

fn into_with_bloom(self) -> ReceiptWithBloom<Self>

Consumes the type and converts it into [ReceiptWithBloom] with the computed bloom filter [Self::bloom] and the receipt.
§

impl<Signature, T> TxSigner<Signature> for Arc<T>
where T: TxSigner<Signature> + ?Sized,

§

fn address(&self) -> Address

Get the address of the signer.
§

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,

Asynchronously sign an unsigned transaction.
§

impl<Signature, T> TxSignerSync<Signature> for Arc<T>
where T: TxSignerSync<Signature> + ?Sized,

§

fn address(&self) -> Address

Get the address of the signer.
§

fn sign_transaction_sync( &self, tx: &mut (dyn SignableTransaction<Signature> + 'static), ) -> Result<Signature, Error>

Synchronously sign an unsigned transaction.
§

impl<T> ValueParserFactory for Arc<T>
where T: ValueParserFactory + Send + Sync + Clone, <T as ValueParserFactory>::Parser: TypedValueParser<Value = T>,

§

type Parser = MapValueParser<<T as ValueParserFactory>::Parser, fn(_: T) -> Arc<T>>

Generated parser, usually [ValueParser]. Read more
§

fn value_parser() -> <Arc<T> as ValueParserFactory>::Parser

Create the specified [Self::Parser]
Source§

impl<T> WithdrawalsProvider for Arc<T>
where T: WithdrawalsProvider + ?Sized, Arc<T>: Send + Sync,

Source§

fn withdrawals_by_block( &self, id: HashOrNumber, timestamp: u64, ) -> Result<Option<Withdrawals>, ProviderError>

Get withdrawals by block id.
§

impl<T> WrapperTypeDecode for Arc<T>

Available on target_has_atomic="ptr" only.
§

type Wrapped = T

A wrapped type.
§

impl<'a, T> Writeable for Arc<T>
where T: Writeable + ?Sized,

§

fn write_to<W>(&self, sink: &mut W) -> Result<(), Error>
where W: Write + ?Sized,

Writes a string to the given sink. Errors from the sink are bubbled up. The default implementation delegates to write_to_parts, and discards any Part annotations.
§

fn write_to_parts<W>(&self, sink: &mut W) -> Result<(), Error>
where W: PartsWrite + ?Sized,

Write bytes and 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

Returns a hint for the number of UTF-8 bytes that will be written to the sink. Read more
§

fn write_to_string(&self) -> Cow<'_, str>

Creates a new String with the data from this Writeable. Like ToString, but smaller and faster. Read more
§

fn writeable_cmp_bytes(&self, other: &[u8]) -> Ordering

Compares the contents of this Writeable to the given bytes without allocating a String to hold the Writeable contents. Read more
§

impl<T> CartablePointerLike for Arc<T>

Available on crate feature alloc only.
§

impl<T> CloneStableDeref for Arc<T>
where T: ?Sized,

Available on crate feature alloc only.
§

impl<T> CloneableCart for Arc<T>
where T: ?Sized,

Available on crate feature alloc only.
§

impl<T> CloneableCartablePointerLike for Arc<T>

Available on crate feature alloc only.
Source§

impl<T, U, A> CoerceUnsized<Arc<U, A>> for Arc<T, A>
where T: Unsize<U> + ?Sized, A: Allocator, U: ?Sized,

Source§

impl<T, A> DerefPure for Arc<T, A>
where A: Allocator, T: ?Sized,

Source§

impl<T, U> DispatchFromDyn<Arc<U>> for Arc<T>
where T: Unsize<U> + ?Sized, U: ?Sized,

§

impl<T> EncodeLike<T> for Arc<T>
where T: Encode,

§

impl<T> EncodeLike for Arc<T>
where T: Encode + ?Sized,

1.0.0 · Source§

impl<T, A> Eq for Arc<T, A>
where T: Eq + ?Sized, A: Allocator,

Source§

impl<T, A> PinCoerceUnsized for Arc<T, A>
where A: Allocator, T: ?Sized,

§

impl<T> Receipt for Arc<T>
where Arc<T>: Send + Sync + Unpin + Clone + Debug + TxReceipt<Log = Log> + RlpEncodableReceipt + RlpDecodableReceipt + Eip2718EncodableReceipt + Typed2718 + MaybeSerde + InMemorySize, T: Receipt + ?Sized,

1.0.0 · Source§

impl<T, A> Send for Arc<T, A>
where T: Sync + Send + ?Sized, A: Allocator + Send,

§

impl<T> StableDeref for Arc<T>
where T: ?Sized,

Available on crate feature alloc only.
1.0.0 · Source§

impl<T, A> Sync for Arc<T, A>
where T: Sync + Send + ?Sized, A: Allocator + Sync,

1.33.0 · Source§

impl<T, A> Unpin for Arc<T, A>
where A: Allocator, T: ?Sized,

1.9.0 · Source§

impl<T, A> UnwindSafe for Arc<T, A>

§

impl<T> WrapperTypeEncode for Arc<T>
where T: ?Sized,