Skip to content
This repository was archived by the owner on Nov 26, 2024. It is now read-only.

Commit 458264b

Browse files
committed
Add a len function to GenerateToAddress
Add a convenience function to the `GenerateToAddress` model type to get the number of blocks generated.
1 parent bc2870f commit 458264b

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

json/src/model/generating.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,8 @@ use serde::{Deserialize, Serialize};
1111
/// Models the result of JSON-RPC method `generatetoaddress`.
1212
#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
1313
pub struct GenerateToAddress(pub Vec<BlockHash>);
14+
15+
impl GenerateToAddress {
16+
/// Returns the number of blocks generated.
17+
pub fn len(&self) -> usize { self.0.len() }
18+
}

0 commit comments

Comments
 (0)