Skip to content

Commit

Permalink
Loosen File and Stream filename type constraints.
Browse files Browse the repository at this point in the history
Maintains the same public API (e.g., type constraints on methods remains the same),
but allows FilePaths.jl to extend the public methods to work with `AbstractPath`s.
This seemed preferable to depending directly on FilePathsBase or loosening the type constraints on all methods.
  • Loading branch information
rofinn committed Apr 29, 2020
1 parent 0423143 commit 3e4f4e2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ DataFormat `fmt`. For example, `File{fmtpng}(filename)` would indicate a PNG
file.
"""
struct File{F<:DataFormat} <: Formatted{F}
filename::String
filename
end
File(fmt::Type{DataFormat{sym}}, filename) where {sym} = File{fmt}(filename)

Expand All @@ -53,7 +53,7 @@ be used to improve error messages, etc.
"""
struct Stream{F <: DataFormat, IOtype <: IO} <: Formatted{F}
io::IOtype
filename::Union{String, Nothing}
filename
end

Stream(::Type{F}, io::IO) where {F<:DataFormat} = Stream{F,typeof(io)}(io, nothing)
Expand Down

0 comments on commit 3e4f4e2

Please sign in to comment.