changeset 726:103f61d09a8b feature/static_dict

More documentation
author Jonatan Werpers <jonatan@werpers.com>
date Wed, 17 Mar 2021 20:21:36 +0100
parents e5b51c82f83b
children 1a8ef927e732
files src/StaticDicts/StaticDicts.jl
diffstat 1 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/StaticDicts/StaticDicts.jl	Wed Mar 17 20:16:20 2021 +0100
+++ b/src/StaticDicts/StaticDicts.jl	Wed Mar 17 20:21:36 2021 +0100
@@ -13,6 +13,9 @@
 https://github.com/JuliaLang/julia/issues/4648 for details)
 
 Lookups are done by linear search.
+
+Duplicate keys are not allowed and an error will be thrown if they are passed
+to the constructor.
 """
 struct StaticDict{K,V,N} <: AbstractDict{K,V}
     pairs::NTuple{N,Pair{K,V}}
@@ -50,7 +53,12 @@
 Base.length(d::StaticDict) = length(d.pairs)
 
 
-# TODO documentation: duplicate keys not allowed atm.  will error
+"""
+    merge(d1::StaticDict, d2::StaticDict)
+
+Merge two `StaticDict`. Repeating keys is considered and error. This may
+change in a future version.
+"""
 function Base.merge(d1::StaticDict, d2::StaticDict)
     return StaticDict(d1.pairs..., d2.pairs...)
 end