teasel 0.14.0

Lightweight CLI utilities for inspecting Miden files, local stores, and RPC endpoints
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use anyhow::Result;
use miden_client::Word;

/// Build and print a Word from user-supplied input.
pub(crate) fn build_word(word: Word) -> Result<()> {
    println!("Word (as hex): {}", word.to_hex());
    println!(
        "Word (decimal felts): {:?}",
        word.map(|f| f.as_canonical_u64())
    );

    let hex_parts: Vec<String> = word
        .map(|f| format!("0x{:016x}", f.as_canonical_u64()))
        .to_vec();
    println!("Word (hex felts): [{}]", hex_parts.join(", "));
    Ok(())
}