Skip to content

Instantly share code, notes, and snippets.

@mitchchn
mitchchn / rustitup.rs
Created May 7, 2019 22:46
OPID parsing methods in Rust
impl Form {
/// Converts legacy `__form__0` to `0`.
pub fn get_id(&self) -> Result<i32, std::num::ParseIntError> {
parse_form_opid(self.opid.as_str())
}
}
impl Field {
/// Taking the old school `"__0"` and turning it into `0`