(s: &str)
| 239 | impl FromStr for ShortChannelId { |
| 240 | type Err = crate::Error; |
| 241 | fn from_str(s: &str) -> Result<Self, Self::Err> { |
| 242 | let parts: Result<Vec<u64>, _> = s.split('x').map(|p| p.parse()).collect(); |
| 243 | let parts = parts.with_context(|| format!("Malformed short_channel_id: {}", s))?; |
| 244 | if parts.len() != 3 { |
| 245 | return Err(anyhow!( |
| 246 | "Malformed short_channel_id: element count mismatch" |
| 247 | )); |
| 248 | } |
| 249 | |
| 250 | Ok(ShortChannelId( |
| 251 | (parts[0] << 40) | (parts[1] << 16) | (parts[2] << 0), |
| 252 | )) |
| 253 | } |
| 254 | } |
| 255 | impl From<u64> for ShortChannelId { |
| 256 | fn from(scid: u64) -> Self { |
nothing calls this directly
no test coverage detected