MCPcopy Create free account
hub / github.com/ddimaria/rust-blockchain-tutorial / get_hex_blocknumber

Method get_hex_blocknumber

web3/src/block.rs:21–26  ·  view source on GitHub ↗

Utility function for unwrapping an optional BlockNumber. If the Option is Some, convert it to a hex string. If the Option is None, use "latest".

(block_number: Option<BlockNumber>)

Source from the content-addressed store, hash-verified

19 /// If the Option is Some, convert it to a hex string.
20 /// If the Option is None, use "latest".
21 pub(crate) fn get_hex_blocknumber(block_number: Option<BlockNumber>) -> String {
22 block_number.map_or_else(
23 || "latest".to_string(),
24 |block_number| to_hex(*block_number),
25 )
26 }
27
28 /// Retrieve the block number of the current block.
29 ///

Callers

nothing calls this directly

Calls 1

to_hexFunction · 0.85

Tested by

no test coverage detected