Skip to content

Commit 7c079ad

Browse files
committed
allow custom module name
1 parent 5e79202 commit 7c079ad

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

src/implements.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,11 @@ function _implements_inner(interface, objtype; show=false)
5757
end
5858
quote
5959
# Define a `implements` trait stating that `objtype` implements `interface`
60-
Interfaces.implements(::Type{<:$interfacetype}, ::Type{<:$objtype}) = true
61-
Interfaces.implements(T::Type{<:$interfacetype{Options}}, O::Type{<:$objtype}) where Options =
62-
Interfaces._all_in(Options, Interfaces.optional_keys(T, O))
60+
$Interfaces.implements(::Type{<:$interfacetype}, ::Type{<:$objtype}) = true
61+
$Interfaces.implements(T::Type{<:$interfacetype{Options}}, O::Type{<:$objtype}) where Options =
62+
$Interfaces._all_in(Options, $Interfaces.optional_keys(T, O))
6363
# Define which optional components the object implements
64-
Interfaces.optional_keys(::Type{<:$interfacetype}, ::Type{<:$objtype}) = $optional_keys
64+
$Interfaces.optional_keys(::Type{<:$interfacetype}, ::Type{<:$objtype}) = $optional_keys
6565
nothing
6666
end |> esc
6767
end

src/interface.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,17 +56,17 @@ description = "A description of the interface"
5656
macro interface(interface::Symbol, components, description)
5757
quote
5858
# Define the interface type (should it be concrete?)
59-
abstract type $interface{Components} <: Interfaces.Interface{Components} end
59+
abstract type $interface{Components} <: $Interfaces.Interface{Components} end
6060
# Define the interface component methods
6161
@assert $components isa NamedTuple{(:mandatory,:optional)}
62-
Interfaces.components(::Type{<:$interface}) = $components
62+
$Interfaces.components(::Type{<:$interface}) = $components
6363
@assert $description isa String
64-
Interfaces.description(::Type{<:$interface}) = $description
64+
$Interfaces.description(::Type{<:$interface}) = $description
6565
# Generate a docstring for the interface
6666
let description=$description,
6767
interfacesym=$(QuoteNode(interface)),
68-
m_keys=Interfaces.mandatory_keys($interface),
69-
o_keys=Interfaces.optional_keys($interface)
68+
m_keys=$Interfaces.mandatory_keys($interface),
69+
o_keys=$Interfaces.optional_keys($interface)
7070
@doc """
7171
$(" ") $interfacesym
7272

0 commit comments

Comments
 (0)