@propagate_inbounds function Base.getindex()

in src/arraytypes/struct.jl [36:54]


@propagate_inbounds function Base.getindex(s::Struct{T,S}, i::Integer) where {T,S}
    @boundscheck checkbounds(s, i)
    NT = Base.nonmissingtype(T)
    if isnamedtuple(NT) || istuple(NT)
        if NT !== T
            return s.validity[i] ? NT(ntuple(j -> s.data[j][i], fieldcount(S))) : missing
        else
            return NT(ntuple(j -> s.data[j][i], fieldcount(S)))
        end
    else
        if NT !== T
            return s.validity[i] ?
                   ArrowTypes.fromarrow(NT, (s.data[j][i] for j = 1:fieldcount(S))...) :
                   missing
        else
            return ArrowTypes.fromarrow(NT, (s.data[j][i] for j = 1:fieldcount(S))...)
        end
    end
end