Skip to content

Commit

Permalink
Add Functors compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
avik-pal committed Feb 25, 2024
1 parent 2c4fed7 commit 23b996f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/ComponentArrays.jl
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ include("compat/chainrulescore.jl")
include("compat/static_arrays.jl")
export @static_unpack

include("compat/functors.jl")

import PackageExtensionCompat: @require_extensions
function __init__()
@require_extensions
Expand Down
4 changes: 4 additions & 0 deletions src/compat/functors.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
function Functors.functor(::Type{<:ComponentArray}, c)
return (
NamedTuple{propertynames(c)}(getproperty.((c,), propertynames(c))), ComponentArray)
end

0 comments on commit 23b996f

Please sign in to comment.