@@ -1214,7 +1214,7 @@ defmodule GenStage do
1214
1214
1215
1215
This function will return `:ok` if the info message is successfully queued.
1216
1216
"""
1217
- @ spec sync_info ( stage , msg :: term ( ) , timeout ) :: :ok
1217
+ @ spec sync_info ( stage , msg :: term , timeout ) :: :ok
1218
1218
def sync_info ( stage , msg , timeout \\ 5_000 ) do
1219
1219
call ( stage , { :"$info" , msg } , timeout )
1220
1220
end
@@ -1229,7 +1229,7 @@ defmodule GenStage do
1229
1229
This call returns `:ok` regardless if the info has been successfully
1230
1230
queued or not. It is typically called from the stage itself.
1231
1231
"""
1232
- @ spec async_info ( stage , msg :: term ( ) ) :: :ok
1232
+ @ spec async_info ( stage , msg :: term ) :: :ok
1233
1233
def async_info ( stage , msg ) do
1234
1234
cast ( stage , { :"$info" , msg } )
1235
1235
end
@@ -1321,7 +1321,7 @@ defmodule GenStage do
1321
1321
1322
1322
See `sync_subscribe/2` for options and more information.
1323
1323
"""
1324
- @ spec sync_resubscribe ( stage , subscription_tag , term , subscription_options , timeout ) ::
1324
+ @ spec sync_resubscribe ( stage , subscription_tag , reason :: term , subscription_options , timeout ) ::
1325
1325
{ :ok , subscription_tag } | { :error , :not_a_consumer } | { :error , { :bad_opts , String . t ( ) } }
1326
1326
def sync_resubscribe ( stage , subscription_tag , reason , opts , timeout \\ 5000 ) do
1327
1327
sync_subscribe ( stage , { subscription_tag , reason } , opts , timeout )
@@ -1400,7 +1400,8 @@ defmodule GenStage do
1400
1400
It accepts the same options as `Process.send/3`, and returns the same value as
1401
1401
`Process.send/3`.
1402
1402
"""
1403
- @ spec ask ( from , non_neg_integer , [ :noconnect | :nosuspend ] ) :: :ok | :noconnect | :nosuspend
1403
+ @ spec ask ( from , demand :: non_neg_integer , [ :noconnect | :nosuspend ] ) ::
1404
+ :ok | :noconnect | :nosuspend
1404
1405
def ask ( producer_subscription , demand , opts \\ [ ] )
1405
1406
1406
1407
def ask ( { _pid , _ref } , 0 , _opts ) do
@@ -1434,7 +1435,7 @@ defmodule GenStage do
1434
1435
is useful when working across nodes. This function returns
1435
1436
the same value as `Process.send/3`.
1436
1437
"""
1437
- @ spec cancel ( from , term , [ :noconnect | :nosuspend ] ) :: :ok | :noconnect | :nosuspend
1438
+ @ spec cancel ( from , reason :: term , [ :noconnect | :nosuspend ] ) :: :ok | :noconnect | :nosuspend
1438
1439
def cancel ( { pid , ref } = _producer_subscription , reason , opts \\ [ ] ) do
1439
1440
Process . send ( pid , { :"$gen_producer" , { self ( ) , ref } , { :cancel , reason } } , opts )
1440
1441
end
@@ -1542,7 +1543,7 @@ defmodule GenStage do
1542
1543
If the reason is any other than `:normal`, `:shutdown` or
1543
1544
`{:shutdown, _}`, an error report is logged.
1544
1545
"""
1545
- @ spec stop ( stage , term , timeout ) :: :ok
1546
+ @ spec stop ( stage , reason :: term , timeout ) :: :ok
1546
1547
def stop ( stage , reason \\ :normal , timeout \\ :infinity ) do
1547
1548
:gen . stop ( stage , reason , timeout )
1548
1549
end
@@ -1601,7 +1602,7 @@ defmodule GenStage do
1601
1602
All other options that would be given for `start_link/3` are
1602
1603
also accepted.
1603
1604
"""
1604
- @ spec from_enumerable ( Enumerable . t ( ) , keyword ( ) ) :: GenServer . on_start ( )
1605
+ @ spec from_enumerable ( Enumerable . t ( ) , keyword ) :: GenServer . on_start ( )
1605
1606
def from_enumerable ( stream , opts \\ [ ] ) do
1606
1607
case Keyword . pop ( opts , :link , true ) do
1607
1608
{ true , opts } -> start_link ( GenStage.Streamer , { stream , opts } , opts )
0 commit comments