pub fn maybe_to_int(
interp: &mut Artichoke,
value: Value,
) -> Result<MaybeToInt, Error>Expand description
Attempt a fallible conversion of the given value to i64.
Conversion steps:
- If the given value is an
Integer, return its underlyingi64. - If the value does not have a
to_intmethod, the conversion is not applicable so returnNone. - If
value.to_intraises, return the exception inErr(_). - If the value returned by the conversion is an
Integer, return its underlyingi64. - Else, the conversion is not applicable so return
None.