Skip to content

Commit 5684e8d

Browse files
authored
Support FixedSizeArrays (#16)
1 parent 64f53fb commit 5684e8d

File tree

4 files changed

+43
-2
lines changed

4 files changed

+43
-2
lines changed

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,17 @@ Any new features, or breaking changes, will be written in this file.
44
Bugfixes, internal refactors, documentation improvements and style changes will
55
not be mentioned here, because they do not impact how the package is to be used.
66

7+
## 0.3.2
8+
* Support FixedSizeArrays
9+
* Various bugfixes and optimisations
10+
* Format with Runic
11+
12+
13+
## 0.3.1
14+
* Fix a bug in parentindices, where it returned the wrong type
15+
* Make `similar` return a mutable array always
16+
* Various bugfixes and optimisations
17+
718
## 0.3.0
819
### Breaking changes
920
* Change the bounds checking behaviour of the find* functions to match those of

Project.toml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,28 @@
11
name = "MemoryViews"
22
uuid = "a791c907-b98b-4e44-8f4d-e4c2362c6b2f"
3-
version = "0.3.1"
3+
version = "0.3.2"
44
authors = ["Jakob Nybo Nissen <jakobnybonissen@gmail.com>"]
55

66
[weakdeps]
77
StringViews = "354b36f9-a18e-4713-926e-db85100087ba"
8+
FixedSizeArrays = "3821ddf9-e5b5-40d5-8e25-6813ab96b5e2"
89

910
[extensions]
1011
StringViewsExt = "StringViews"
12+
FixedSizeArraysExt = "FixedSizeArrays"
1113

1214
[compat]
1315
Aqua = "0.8.7"
1416
StringViews = "1"
17+
FixedSizeArrays = "1"
1518
Test = "1.11"
1619
julia = "1.11"
1720

1821
[extras]
1922
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
23+
FixedSizeArrays = "3821ddf9-e5b5-40d5-8e25-6813ab96b5e2"
2024
StringViews = "354b36f9-a18e-4713-926e-db85100087ba"
2125
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
2226

2327
[targets]
24-
test = ["Aqua", "StringViews", "Test"]
28+
test = ["Aqua", "FixedSizeArrays", "StringViews", "Test"]

ext/FixedSizeArraysExt.jl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
module FixedSizeArraysExt
2+
3+
using FixedSizeArrays: FixedSizeArray
4+
using MemoryViews: MemoryViews, MemoryView, MemoryKind, MutableMemoryView
5+
6+
MemoryViews.MemoryKind(::Type{<:FixedSizeArray{T, N, M}}) where {T, N, M} = MemoryKind(M)
7+
MemoryViews.MemoryView(x::FixedSizeArray) = MemoryView(x.mem)
8+
9+
end # module

test/runtests.jl

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using Test
2+
using FixedSizeArrays
23
using MemoryViews
34
using Aqua
45
using StringViews: StringView
@@ -633,4 +634,20 @@ end
633634
@test MemoryKind(typeof(s)) == NotMemory()
634635
end
635636

637+
@testset "FixedSizeArrays" begin
638+
for A in [
639+
FixedSizeArray([1, 2, 3]),
640+
FixedSizeArray(zeros(Float32, 4, 3)),
641+
FixedSizeArray(fill("abc", 4, 3)),
642+
FixedSizeArray{Int16}(undef, 2, 2),
643+
FixedSizeArray(b"Hello, world!"),
644+
]
645+
mem = MemoryView(A)
646+
@test length(mem) == length(A)
647+
@test mem == vec(A)
648+
@test typeof(mem) == MutableMemoryView{eltype(A)}
649+
@test MemoryKind(typeof(A)) == IsMemory(MutableMemoryView{eltype(A)})
650+
end
651+
end
652+
636653
Aqua.test_all(MemoryViews)

0 commit comments

Comments
 (0)