fn resolve_u8()

in crates/core/src/avro_to_arrow/arrow_array_reader.rs [868:881]


fn resolve_u8(v: &Value) -> AvroResult<u8> {
    let int = match v {
        Value::Int(n) => Ok(Value::Int(*n)),
        Value::Long(n) => Ok(Value::Int(*n as i32)),
        other => Err(AvroError::GetU8(other.into())),
    }?;
    if let Value::Int(n) = int {
        if n >= 0 && n <= u8::MAX as i32 {
            return Ok(n as u8);
        }
    }

    Err(AvroError::GetU8(int.into()))
}