[−][src]Function cjdns_core::splice::get_encoding_form
pub fn get_encoding_form<L: LabelBits>(
label: RoutingLabel<L>,
scheme: &EncodingScheme
) -> Result<(EncodingSchemeForm, u8)>
Get the encoding form used for the first director of the RoutingLabel
.
It also returns index of found form in scheme.
Recall an encoding scheme is one or more encoding forms.
If the label is not recognized as using the given scheme then it'll return Err(Error::CannotFindForm)
.
let form = get_encoding_form(l("0000.0000.0000.0013"), &schemes::V358); assert_eq!(form, Ok((encoding_form(3, 1, 1), 0))); let form = get_encoding_form(l("0000.0000.0000.1110"), &schemes::V358); assert_eq!(form, Ok((encoding_form(8, 2, 0), 2)));