Skip to content

Commit 5831d46

Browse files
authored
Define MemoryKind for MemoryView (#28)
The absence here was an oversight.
1 parent 7cc0926 commit 5831d46

File tree

4 files changed

+9
-1
lines changed

4 files changed

+9
-1
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ 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.5
8+
* Add method `MemoryKind{::Type{<:MemoryView}}`
9+
* Add package extension for LibDeflate.jl
10+
711
## 0.3.4
812
* Add new function `unsafe_from_parts` to construct a memory view from a
913
`MemoryRef`.

Project.toml

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

66
[weakdeps]

src/MemoryViews.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,7 @@ inner(::IsMemory{T}) where {T} = T
214214

215215
MemoryKind(::Type) = NotMemory()
216216
MemoryKind(::Type{Union{}}) = NotMemory()
217+
MemoryKind(::Type{T}) where {T <: MemoryView} = IsMemory(T)
217218

218219
include("construction.jl")
219220
include("basic.jl")

test/runtests.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -726,6 +726,9 @@ end
726726
@test MemoryKind(Memory{Int32}) == IsMemory(MutableMemoryView{Int32})
727727
@test MemoryKind(typeof(view([1], 1:1))) == IsMemory(MutableMemoryView{Int})
728728

729+
@test MemoryKind(ImmutableMemoryView{Dict}) == IsMemory(ImmutableMemoryView{Dict})
730+
@test MemoryKind(MutableMemoryView{UInt32}) == IsMemory(MutableMemoryView{UInt32})
731+
729732
@test inner(IsMemory(MutableMemoryView{Int32})) == MutableMemoryView{Int32}
730733
@test inner(IsMemory(ImmutableMemoryView{Tuple{String, Int}})) ==
731734
ImmutableMemoryView{Tuple{String, Int}}

0 commit comments

Comments
 (0)