[−][src]Function cjdns_core::splice::unsplice
pub fn unsplice<L: LabelBits>(
destination: RoutingLabel<L>,
mid_path: RoutingLabel<L>
) -> Result<RoutingLabel<L>>
Convert a full path to a representation which a node along that path can use.
This will output a value which if passed to splice()
with the input mid_path
, would yield the input destination
.
If routes_through(destination, mid_path)
would return false
, this returns an Err(Error::CannotUnsplice)
.
assert_eq!(splice(&[l("0000.0000.0000.0015"), l("0000.0000.0000.0013")]), Ok(l("0000.0000.0000.0153"))); assert_eq!(unsplice(l("0000.0000.0000.0153"), l("0000.0000.0000.0013")), Ok(l("0000.0000.0000.0015")));