We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0068ff2 commit cf7c3feCopy full SHA for cf7c3fe
src/memory.jl
@@ -11,6 +11,10 @@ struct Memory
11
size::UInt
12
end
13
14
+function Memory(data::Vector{UInt8})
15
+ return Memory(pointer(data), sizeof(data))
16
+end
17
+
18
function Base.length(mem::Memory)
19
return mem.size
20
test/runtests.jl
@@ -23,6 +23,12 @@ using Base.Test
23
@test mem[3] === UInt8('!')
24
@test_throws BoundsError mem[7] = 0x00
25
@test_throws BoundsError mem[0] = 0x00
26
27
+ data = b"foobar"
28
+ mem = TranscodingStreams.Memory(data)
29
+ @test mem isa TranscodingStreams.Memory
30
+ @test mem.ptr == pointer(data)
31
+ @test mem.size == sizeof(data)
32
33
34
@testset "Identity Codec" begin
0 commit comments