chore: fix rustdoc broken doc links and warnings

This commit is contained in:
oars
2026-01-02 22:22:38 +03:00
parent 6c0dafbceb
commit e641ac09f4
12 changed files with 52 additions and 45 deletions

View File

@@ -94,7 +94,8 @@ impl Default for ExplorerConfig {
}
}
/// Attempts to convert a [`PathBuff`] to an [`ExplorerConfig`] by loading and parsing from specified file path.
/// Attempts to convert a [`PathBuf`] to an [`ExplorerConfig`] by
/// loading and parsing from specified file path.
impl TryFrom<&PathBuf> for ExplorerConfig {
type Error = Error;
fn try_from(path: &PathBuf) -> Result<Self> {

View File

@@ -52,14 +52,15 @@ impl From<ExplorerdError> for Error {
}
}
/// Conversion from [`ExplorerdRpcError`] to [`RpcError`]
/// Conversion from [`ExplorerdError`] to [`RpcError`]
impl From<ExplorerdError> for RpcError {
fn from(err: ExplorerdError) -> Self {
RpcError::ServerError(Arc::new(err))
}
}
/// Helper function to convert `ExplorerdRpcError` into error code with corresponding error message.
/// Helper function to convert `ExplorerdError` into error code with
/// corresponding error message.
pub fn to_error_code_message(e: &ExplorerdError) -> (i32, String) {
match e {
ExplorerdError::PingDarkfidFailed(_) => (ERROR_CODE_PING_DARKFID_FAILED, e.to_string()),

View File

@@ -118,9 +118,10 @@ impl ExplorerService {
/// Adds the provided [`BlockInfo`] to the block explorer database.
///
/// This function processes each transaction in the block, calculating and updating the
/// latest [`GasMetrics`] for non-genesis blocks and for transactions that are not
/// PoW rewards. PoW reward transactions update the contract runtime state as required.
/// This function processes each transaction in the block, calculating
/// and updating the latest [`crate::store::metrics::GasMetrics`] for
/// non-genesis blocks and for transactions that are not PoW rewards.
/// PoW reward transactions update the contract runtime state as required.
/// After processing all transactions, the block is permanently persisted to
/// the explorer database.
pub async fn put_block(&self, block: &BlockInfo) -> Result<()> {
@@ -295,17 +296,19 @@ impl ExplorerService {
Ok(block_records)
}
/// Resets the [`ExplorerDb::blockchain::blocks`] and [`ExplorerDb::blockchain::transactions`]
/// trees to a specified height by removing entries above the `reset_height`, returning a result
/// that indicates success or failure.
/// Resets the `blocks` and `transactions` trees to a specified
/// height by removing entries above the `reset_height`,
/// returning a result that indicates success or failure.
///
/// The function retrieves the last explorer block and iteratively rolls back entries
/// in the [`BlockStore::main`], [`BlockStore::order`], and [`BlockStore::difficulty`] trees
/// to the specified `reset_height`. It also resets the [`TxStore::main`] and
/// [`TxStore::location`] trees to reflect the transaction state at the given height.
/// The function retrieves the last explorer block and iteratively
/// rolls back entries in the `main`, `order`, and `difficulty`
/// trees to the specified `reset_height`. It also resets the `main`
/// and `location` trees to reflect the transaction state at
/// the given height.
///
/// This operation is performed atomically using a sled transaction applied across the affected sled
/// trees, ensuring consistency and avoiding partial updates.
/// This operation is performed atomically using a sled transaction
/// applied across the affected sled trees, ensuring consistency and
/// avoiding partial updates.
pub fn reset_to_height(&self, reset_height: u32) -> Result<()> {
let block_store = &self.db.blockchain.blocks;
let tx_store = &self.db.blockchain.transactions;

View File

@@ -62,7 +62,7 @@ pub struct ContractMetaStore {
/// Pointer to the underlying sled database used by the store and its associated overlay.
pub sled_db: sled::Db,
/// Primary sled tree for storing contract metadata, utilizing [`ContractId::to_string`] as keys
/// Primary sled tree for storing contract metadata, utilizing [`ContractId`] as keys
/// and serialized [`ContractMetaData`] as values.
pub main: sled::Tree,

View File

@@ -247,7 +247,8 @@ pub struct MetricsStore {
// Temporarily disable unused warnings until the store is integrated with the explorer
#[allow(dead_code)]
impl MetricsStore {
/// Creates a [`MetricsStore`] instance by opening the necessary trees in the provided sled database [`Db`]
/// Creates a [`MetricsStore`] instance by opening the necessary
/// trees in the provided sled database [`sled::Db`]
pub fn new(db: &sled::Db) -> Result<Self> {
let main = db.open_tree(SLED_GAS_METRICS_TREE)?;
let tx_gas_data = db.open_tree(SLED_TX_GAS_DATA_TREE)?;
@@ -406,7 +407,8 @@ struct MetricsStoreOverlay {
}
impl MetricsStoreOverlay {
/// Instantiate a [`MetricsStoreOverlay`] over the provided [`SledDbPtr`] instance.
/// Instantiate a [`MetricsStoreOverlay`] over the provided
/// [`sled::Db`] instance.
pub fn new(db: sled::Db) -> Result<Self> {
// Create overlay pointer
let overlay = Arc::new(Mutex::new(SledDbOverlay::new(&db, vec![])));