diff options
| author | Jean-Sébastien Pédron <jean-sebastien@rabbitmq.com> | 2016-06-28 15:26:41 +0200 |
|---|---|---|
| committer | Jean-Sébastien Pédron <jean-sebastien@rabbitmq.com> | 2016-06-28 16:02:00 +0200 |
| commit | fa20bbcc482e3bd09678351191ee9a296113b3dc (patch) | |
| tree | 48f231deb1eb3d8a1396cf12c21821942b464382 /src/lqueue.erl | |
| parent | d27a16388d28e753120f30b047ab64077abb9f88 (diff) | |
| download | rabbitmq-server-git-fa20bbcc482e3bd09678351191ee9a296113b3dc.tar.gz | |
Use the new -spec format
The old format is removed in Erlang 19.0, leading to build errors.
Also, get rid of the `use_specs` macro and thus always define -spec() &
friends.
While here, unnify the style of -type and -spec.
References #860.
[#118562897]
[#122335241]
Diffstat (limited to 'src/lqueue.erl')
| -rw-r--r-- | src/lqueue.erl | 40 |
1 files changed, 18 insertions, 22 deletions
diff --git a/src/lqueue.erl b/src/lqueue.erl index 4e78346feb..1e24e9e75f 100644 --- a/src/lqueue.erl +++ b/src/lqueue.erl @@ -25,30 +25,26 @@ -define(QUEUE, queue). --ifdef(use_specs). - -export_type([?MODULE/0]). --opaque(?MODULE() :: {non_neg_integer(), ?QUEUE:?QUEUE()}). --type(value() :: any()). --type(result() :: 'empty' | {'value', value()}). - --spec(new/0 :: () -> ?MODULE()). --spec(is_empty/1 :: (?MODULE()) -> boolean()). --spec(len/1 :: (?MODULE()) -> non_neg_integer()). --spec(in/2 :: (value(), ?MODULE()) -> ?MODULE()). --spec(in_r/2 :: (value(), ?MODULE()) -> ?MODULE()). --spec(out/1 :: (?MODULE()) -> {result(), ?MODULE()}). --spec(out_r/1 :: (?MODULE()) -> {result(), ?MODULE()}). --spec(join/2 :: (?MODULE(), ?MODULE()) -> ?MODULE()). --spec(foldl/3 :: (fun ((value(), B) -> B), B, ?MODULE()) -> B). --spec(foldr/3 :: (fun ((value(), B) -> B), B, ?MODULE()) -> B). --spec(from_list/1 :: ([value()]) -> ?MODULE()). --spec(to_list/1 :: (?MODULE()) -> [value()]). --spec(peek/1 :: (?MODULE()) -> result()). --spec(peek_r/1 :: (?MODULE()) -> result()). - --endif. +-opaque ?MODULE() :: {non_neg_integer(), ?QUEUE:?QUEUE()}. +-type value() :: any(). +-type result() :: 'empty' | {'value', value()}. + +-spec new() -> ?MODULE(). +-spec is_empty(?MODULE()) -> boolean(). +-spec len(?MODULE()) -> non_neg_integer(). +-spec in(value(), ?MODULE()) -> ?MODULE(). +-spec in_r(value(), ?MODULE()) -> ?MODULE(). +-spec out(?MODULE()) -> {result(), ?MODULE()}. +-spec out_r(?MODULE()) -> {result(), ?MODULE()}. +-spec join(?MODULE(), ?MODULE()) -> ?MODULE(). +-spec foldl(fun ((value(), B) -> B), B, ?MODULE()) -> B. +-spec foldr(fun ((value(), B) -> B), B, ?MODULE()) -> B. +-spec from_list([value()]) -> ?MODULE(). +-spec to_list(?MODULE()) -> [value()]. +-spec peek(?MODULE()) -> result(). +-spec peek_r(?MODULE()) -> result(). new() -> {0, ?QUEUE:new()}. |
