Skip to content

Commit f6af6fd

Browse files
fredrikekregiordano
authored andcommitted
Help inference and type-assert return value from readavailable.
1 parent c1784b2 commit f6af6fd

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/BufferStream.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,17 +104,17 @@ function read(bs::BufferStream)
104104
end
105105

106106
# Completely consume the first chunk.
107-
function readavailable(bs::BufferStream)
107+
function readavailable(bs::BufferStream)::SubArray{UInt8, 1, Vector{UInt8}, Tuple{UnitRange{Int64}}, true}
108108
lock(bs.read_cond) do
109109
if isempty(bs.chunks)
110110
if !isopen(bs)
111-
return UInt8[]
111+
return view(UInt8[], 1:0)
112112
end
113113
wait(bs.read_cond)
114-
114+
115115
# Handle cancellation explicitly
116116
if isempty(bs.chunks)
117-
return UInt8[]
117+
return view(UInt8[], 1:0)
118118
end
119119
end
120120

0 commit comments

Comments
 (0)