Skip to content

Commit a56e6d0

Browse files
author
Pietro Vertechi
committed
export collect_structarray
1 parent 3d5377d commit a56e6d0

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/StructArrays.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ module StructArrays
22

33
import Requires
44
export StructArray, StructVector
5+
export collect_structarray
56

67
include("interface.jl")
78
include("structarray.jl")

test/runtests.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ StructArrays.SkipConstructor(::Type{<:S}) = true
237237
end
238238

239239
const initializer = StructArrays.ArrayInitializer(t -> t <: Union{Tuple, NamedTuple, Pair})
240-
collect_structarray_rec(t) = StructArrays.collect_structarray(t, initializer = initializer)
240+
collect_structarray_rec(t) = collect_structarray(t, initializer = initializer)
241241

242242
@testset "collectnamedtuples" begin
243243
v = [(a = 1, b = 2), (a = 1, b = 3)]
@@ -255,7 +255,7 @@ collect_structarray_rec(t) = StructArrays.collect_structarray(t, initializer = i
255255
@test typeof(collect_structarray_rec(v)) == typeof(StructArray((a = Real[1, 1.2], b = Int[2, 3])))
256256

257257
s = StructArray(a = [1, 2], b = [3, 4])
258-
@test StructArrays.collect_structarray(LazyRow(s, i) for i in eachindex(s)) == s
258+
@test collect_structarray(LazyRow(s, i) for i in eachindex(s)) == s
259259
@test collect_structarray_rec(LazyRow(s, i) for i in eachindex(s)) == s
260260

261261
v = [(a = 1, b = 2), (a = 1.2, b = "3")]
@@ -288,8 +288,8 @@ end
288288
@test collect_structarray_rec(v) == StructArray((Int[1, 1], Int[2, 3]))
289289
@inferred collect_structarray_rec(v)
290290

291-
@test StructArrays.collect_structarray(v) == StructArray((Int[1, 1], Int[2, 3]))
292-
@inferred StructArrays.collect_structarray(v)
291+
@test collect_structarray(v) == StructArray((Int[1, 1], Int[2, 3]))
292+
@inferred collect_structarray(v)
293293

294294
v = [(1, 2), (1.2, 3)]
295295
@test collect_structarray_rec(v) == StructArray((Real[1, 1.2], Int[2, 3]))
@@ -381,7 +381,7 @@ end
381381

382382
@testset "collect2D" begin
383383
s = (l for l in [(a=i, b=j) for i in 1:3, j in 1:4])
384-
v = StructArrays.collect_structarray(s)
384+
v = collect_structarray(s)
385385
@test size(v) == (3, 4)
386386
@test v.a == [i for i in 1:3, j in 1:4]
387387
@test v.b == [j for i in 1:3, j in 1:4]

0 commit comments

Comments
 (0)