根据子密钥工具。subkey generate我们可以使用如下命令生成公钥/私钥:
$ subkey generate
Secret phrase `cement drum say almost secret series daughter eager ceiling fetch about duck` is account:
Secret seed: 0xb84c6858ca5f331a703203e853d3537eac0a3d4b54838dc69d8e6d395ab4ec6f
Public key (hex): 0x5075808dbd0eb02828a525c6332596f0e95c3d0b9ecfede376195ca95bca415b
Account ID: 0x5075808dbd0eb02828a525c6332596f0e95c3d0b9ecfede376195ca95bca415b
SS58 Address: 5DtCbNMGwhnP5wJ25Zv59wc5aj5uo3wYdr8536qSRxbvmLdK
Run Code Online (Sandbox Code Playgroud)
我的问题:
我怎样才能Public key从 出发SS58 Address?在此示例中,是否可以0x5075808dbd0eb02828a525c6332596f0e95c3d0b9ecfede376195ca95bca415b从获取5DtCbNMGwhnP5wJ25Zv59wc5aj5uo3wYdr8536qSRxbvmLdK?
我正在学习如何在 Rust 中使用 const 泛型。像这样的简单演示:Playground
有人能告诉我如何使用 const 泛型数组作为返回类型吗?
fn foo<const C: usize>(n: u32) -> [i32; C] {
// failed
// [1; 3]
// failed
[1; n]
}
fn hoo<const N: usize>(arr: [i32; N]) {
println!("the array is {:?}", arr);
}
fn main() {
// Give a number, create a array, this fails
let f = foo(3);
// const array as input
hoo([1]);
hoo([1, 2, 3]);
}
Run Code Online (Sandbox Code Playgroud)
编译信息如下:
Compiling playground v0.0.1 (/playground)
error[E0435]: attempt to use a non-constant value in …Run Code Online (Sandbox Code Playgroud) format!("{:#?}", (100, 200)); // => "(
// 100,
// 200,
// )"
Run Code Online (Sandbox Code Playgroud)
有任何文档可以详细说明这种模式{:#?}吗?