Skip to content

Commit

Permalink
ProteinStructureStore do syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonOresten committed Oct 11, 2024
1 parent 5693494 commit a19bae0
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/store/store.jl
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,15 @@ end
Base.show(io::IO, store::ProteinStructureStore) = print(io, "$ProteinStructureStore(\"$(store.filename)\", $(store.mode))")
Base.show(io::IO, ::MIME"text/plain", store::ProteinStructureStore) = print(io, summary(store))

function ProteinStructureStore(f::Function, args...)
store = ProteinStructureStore(args...)
try
return f(store)
finally
close(store)
end
end

"""
serialize(filename::AbstractString, structures::AbstractVector{<:ProteinStructure})
Expand Down

0 comments on commit a19bae0

Please sign in to comment.