Skip to content
This repository has been archived by the owner on Dec 8, 2023. It is now read-only.

Commit

Permalink
clarify docs
Browse files Browse the repository at this point in the history
  • Loading branch information
pfitzseb committed Jul 25, 2018
1 parent bf09f07 commit 0e37316
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion REQUIRE
Original file line number Diff line number Diff line change
@@ -1 +1 @@
julia 0.7-beta
julia 0.7-beta2
4 changes: 4 additions & 0 deletions src/TreeViews.jl
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ numberofnodes(x::T) where {T} = fieldcount(T)
treelabel(io::IO, x, mime = MIME"text/plain"())
Prints `x`'s tree header to `io`.
Like with `Base.show` there are also methods with `mime::AbstractString` and no `mime` argument at all (which
falls back to `MIME"text/plain"()`). Please only overload the `treelabel(io::IO, x, mime::MIME)` form.
"""
treelabel(io::IO, x::T, mime::MIME"text/plain") where {T} = show(io, mime, T)
treelabel(io::IO, x::T, mime::AbstractString) where {T} = treelabel(io, x, MIME(mime))
Expand All @@ -31,6 +33,8 @@ treelabel(io::IO, x::T) where {T} = treelabel(io, x, MIME"text/plain"())
nodelabel(io::IO, x::T, i::Integer, mime::MIME"text/plain" = MIME"text/plain"())
Prints the label of `x`'s `i`-th child to `io`.
Like with `Base.show` there are also methods with `mime::AbstractString` and no `mime` argument at all (which
falls back to `MIME"text/plain"()`). Please only overload the `nodelabel(io::IO, x, i::Integer, mime::MIME)` form.
"""
function nodelabel(io::IO, x::T, i::Integer, mime::MIME"text/plain") where {T}
show(io, mime, Text(String(fieldname(T, i))))
Expand Down

0 comments on commit 0e37316

Please sign in to comment.