11# Export DynamicLinks API
22export DynamicLinks,
3- getindex, length, iterate, lastindex, eltype,
3+ getindex, length, iterate, keys, lastindex, eltype,
44 handle, header
55
66# Export Dynamic Link API
@@ -12,7 +12,7 @@ export RPath,
1212 handle, rpaths, canonical_rpaths, find_library
1313
1414# Import iteration protocol
15- import Base: iterate, length, lastindex
15+ import Base: iterate, keys, length, lastindex
1616
1717"""
1818 DynamicLinks
@@ -28,6 +28,7 @@ given below, with methods that subclasses must implement marked in emphasis:
2828 - *getindex()*
2929 - *lastindex()*
3030 - iterate()
31+ - keys()
3132 - eltype()
3233
3334### Misc.
@@ -36,6 +37,7 @@ given below, with methods that subclasses must implement marked in emphasis:
3637abstract type DynamicLinks{H <: ObjectHandle } end
3738
3839@mustimplement lastindex (dls:: DynamicLinks )
40+ keys (dls:: DynamicLinks ) = 1 : length (dls)
3941iterate (dls:: DynamicLinks , idx= 1 ) = idx > length (dls) ? nothing : (dls[idx], idx+ 1 )
4042length (dls:: DynamicLinks ) = lastindex (dls)
4143eltype (:: Type{D} ) where {D <: DynamicLinks } = DynamicLink
@@ -107,7 +109,8 @@ Return the list of paths that will be searched for shared libraries.
107109@mustimplement rpaths (rpath:: RPath )
108110
109111lastindex (rpath:: RPath ) = lastindex (rpaths (rpath))
110- iterate (rpaht:: RPath , idx= 1 ) = idx > length (rpath) ? nothing : (rpath[idx], idx+ 1 )
112+ keys (rpath:: RPath ) = 1 : length (rpath)
113+ iterate (rpath:: RPath , idx= 1 ) = idx > length (rpath) ? nothing : (rpath[idx], idx+ 1 )
111114length (rpath:: RPath ) = lastindex (rpath)
112115eltype (:: Type{D} ) where {D <: RPath } = String
113116getindex (rpath:: RPath , idx) = rpaths (rpath)[idx]
0 commit comments