Skip to content

Relax LazyRow for other packages #271

@Moelf

Description

@Moelf

There's no reason why LazyRow can only work with StructArray, for example we had this for a while now:
https://github.com/JuliaHEP/UnROOT.jl/blob/5f9ae4f21f04bf61f56f0ccabe7942754e07f7d9/src/iteration.jl#L196-L199

but essentially for any table-like structure, we simply have:

@inline function Base.getproperty(evt::LazyEvent, s::Symbol)
    @inbounds getproperty(Core.getfield(evt, :tree), s)[Core.getfield(evt, :idx)]
end

and basically this is just saying LazyRow wraps a object that support parent.col[idx]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions