MCPcopy Create free account
hub / github.com/ElementsProject/lightning / try_from

Method try_from

cln-rpc/src/primitives.rs:162–168  ·  view source on GitHub ↗
(v: Vec<u8>)

Source from the content-addressed store, hash-verified

160impl TryFrom<Vec<u8>> for Secret {
161 type Error = crate::Error;
162 fn try_from(v: Vec<u8>) -> Result<Self, crate::Error> {
163 if v.len() != 32 {
164 Err(anyhow!("Unexpected secret length: {}", hex::encode(v)))
165 } else {
166 Ok(Secret(v.try_into().unwrap()))
167 }
168 }
169}
170
171impl Serialize for Secret {

Callers

nothing calls this directly

Calls 2

unwrapMethod · 0.80
SecretClass · 0.70

Tested by

no test coverage detected