Skip to content

Commit f448eb0

Browse files
make Easy parametric for callback specialization
1 parent 46e9d10 commit f448eb0

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/Curl/Easy.jl

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
mutable struct Easy
1+
mutable struct Easy{Input<:IO, Output<:IO, Progress<:Function}
22
handle :: Ptr{Cvoid}
3-
input :: IO
3+
input :: Input
44
done :: Threads.Event
55
seeker :: Union{Function,Nothing}
6-
output :: IO
7-
progress :: Function
6+
output :: Output
7+
progress :: Progress
88
req_hdrs :: Ptr{curl_slist_t}
99
res_hdrs :: Vector{String}
1010
code :: CURLcode
@@ -16,13 +16,14 @@ function Easy(
1616
output :: IO,
1717
progress :: Union{Function,Nothing},
1818
)
19-
easy = Easy(
19+
progress = something(progress, (_, _, _, _) -> nothing)
20+
easy = Easy{typeof(input), typeof(output), typeof(progress)}(
2021
curl_easy_init(),
2122
input,
2223
Threads.Event(),
2324
nothing,
2425
output,
25-
something(progress, (_, _, _, _) -> nothing),
26+
progress,
2627
C_NULL,
2728
String[],
2829
typemax(CURLcode),

0 commit comments

Comments
 (0)