1
1
# Export DynamicLinks API
2
2
export DynamicLinks,
3
- getindex, length, iterate, lastindex, eltype,
3
+ getindex, length, iterate, keys, lastindex, eltype,
4
4
handle, header
5
5
6
6
# Export Dynamic Link API
@@ -12,7 +12,7 @@ export RPath,
12
12
handle, rpaths, canonical_rpaths, find_library
13
13
14
14
# Import iteration protocol
15
- import Base: iterate, length, lastindex
15
+ import Base: iterate, keys, length, lastindex
16
16
17
17
"""
18
18
DynamicLinks
@@ -28,6 +28,7 @@ given below, with methods that subclasses must implement marked in emphasis:
28
28
- *getindex()*
29
29
- *lastindex()*
30
30
- iterate()
31
+ - keys()
31
32
- eltype()
32
33
33
34
### Misc.
@@ -36,6 +37,7 @@ given below, with methods that subclasses must implement marked in emphasis:
36
37
abstract type DynamicLinks{H <: ObjectHandle } end
37
38
38
39
@mustimplement lastindex (dls:: DynamicLinks )
40
+ keys (dls:: DynamicLinks ) = 1 : length (dls)
39
41
iterate (dls:: DynamicLinks , idx= 1 ) = idx > length (dls) ? nothing : (dls[idx], idx+ 1 )
40
42
length (dls:: DynamicLinks ) = lastindex (dls)
41
43
eltype (:: Type{D} ) where {D <: DynamicLinks } = DynamicLink
@@ -107,7 +109,8 @@ Return the list of paths that will be searched for shared libraries.
107
109
@mustimplement rpaths (rpath:: RPath )
108
110
109
111
lastindex (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 )
111
114
length (rpath:: RPath ) = lastindex (rpath)
112
115
eltype (:: Type{D} ) where {D <: RPath } = String
113
116
getindex (rpath:: RPath , idx) = rpaths (rpath)[idx]
0 commit comments