From 87841773ba71bbe8be3ac8a0a27671af2751712c Mon Sep 17 00:00:00 2001 From: SisMaker <1713699517@qq.com> Date: Mon, 29 Mar 2021 00:00:21 +0800 Subject: [PATCH] =?UTF-8?q?ft:=20eFmt=20import=E5=87=BD=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/eFmt.erl | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/eFmt.erl b/src/eFmt.erl index f359fa4..d7fa55a 100644 --- a/src/eFmt.erl +++ b/src/eFmt.erl @@ -1,6 +1,8 @@ -module(eFmt). -import(binary, [split/2, part/3]). +-import(lists, [keyfind/3, reverse/2]). +-import(maps, [iterator/1, next/1]). -compile(inline). -compile({inline_size, 128}). @@ -237,7 +239,7 @@ writeMap(Map, D, E, BinAcc) -> D =:= 1 -> <>; true -> - writeMapBody(maps:iterator(Map), D, E, BinAcc) + writeMapBody(iterator(Map), D, E, BinAcc) end. writeMapBody(I, D, E, BinAcc) -> @@ -245,7 +247,7 @@ writeMapBody(I, D, E, BinAcc) -> D =:= 1 -> <>; true -> - case maps:next(I) of + case next(I) of {K, V, none} -> KeyTermBin = writeTerm(K, -1, E), ValueTermBin = writeTerm(V, -1, E), @@ -369,7 +371,7 @@ writeMap(Map, Depth, Width, Encoding, Strings, SumLC, BinAcc) -> Depth =:= 1 -> <>; true -> - writeMapBody(maps:iterator(Map), Depth, Width, Encoding, Strings, SumLC, BinAcc) + writeMapBody(iterator(Map), Depth, Width, Encoding, Strings, SumLC, BinAcc) end. writeMapBody(I, Depth, Width, Encoding, Strings, SumLC, BinAcc) -> @@ -377,7 +379,7 @@ writeMapBody(I, Depth, Width, Encoding, Strings, SumLC, BinAcc) -> Depth =:= 1 -> <>; true -> - case maps:next(I) of + case next(I) of {K, V, none} -> KeyTermBin = writeTerm(K, -1, Width, Encoding, Strings), ValueTermBin = writeTerm(V, -1, Width, Encoding, Strings), @@ -643,7 +645,7 @@ buildSmall([], CharsLimit, P, S, W, Other, Acc) -> [One, Two, Three] -> [Three, Two, One]; Ret -> - lists:reverse(Ret, []) + reverse(Ret, []) end end; buildSmall([OneCA | Cs], CharsLimit, P, S, W, Other, Acc) -> @@ -1012,7 +1014,7 @@ charsLen(S) -> end. getOpt(Key, TupleList, Default) -> - case lists:keyfind(Key, 1, TupleList) of + case keyfind(Key, 1, TupleList) of false -> Default; ValueTuple ->