pub fn with_head<U, E>(
        &self,
        f: impl FnOnce(&BeaconSnapshot<T::EthSpec>) -> Result<U, E>,
    ) -> Result<U, E>
    where
        E: From<Error>,
    {
        let head_lock = self
            .canonical_head
            .try_read_for(HEAD_LOCK_TIMEOUT)
            .ok_or(Error::CanonicalHeadLockTimeout)?;
        f(&head_lock)
    }
/// Apply a function to the canonical head without cloning it.
Apply a function to the canonical head without cloning it.
Apply a function to the canonical head without cloning it .
pub fn with_head<U, E>(
        &self,
        f: impl FnOnce(&BeaconSnapshot<T::EthSpec>) -> Result<U, E>,
    ) -> Result<U, E>
    where
        E: From<Error>,
    {
        let head_lock = self
            .canonical_head
            .try_read_for(HEAD_LOCK_TIMEOUT)
            .ok_or(Error::CanonicalHeadLockTimeout)?;
        f(&head_lock)
    }
pub fn with_head < U , E > ( & self , f : impl FnOnce ( & BeaconSnapshot < T :: EthSpec > ) -> Result < U , E > , ) -> Result < U , E > where E : From < Error > , { let head_lock = self . canonical_head . try_read_for ( HEAD_LOCK_TIMEOUT ) . ok_or ( Error :: CanonicalHeadLockTimeout ) ? ; f ( & head_lock ) }
Apply a function to the canonical head without cloning it.
Apply a function to the canonical head without cloning it .
&self
f
impl FnOnce(&BeaconSnapshot<T::EthSpec>) -> Result<U, E>