Skip to content

Commit

Permalink
extend write docstring to mention Ref (#30677)
Browse files Browse the repository at this point in the history
  • Loading branch information
jw3126 authored and JeffBezanson committed Jan 23, 2019
1 parent 17c4b02 commit e87b19b
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions base/io.jl
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,19 @@ julia> write(io, "Sometimes those members") + write(io, " write documentation.")
julia> String(take!(io))
"Sometimes those members write documentation."
```
User-defined plain-data types without `write` methods can be written when wrapped in a `Ref`:
```jldoctest
julia> struct MyStruct; x::Float64; end
julia> io = IOBuffer()
IOBuffer(data=UInt8[...], readable=true, writable=true, seekable=true, append=false, size=0, maxsize=Inf, ptr=1, mark=-1)
julia> write(io, Ref(MyStruct(42.0)))
8
julia> seekstart(io); read!(io, Ref(MyStruct(NaN)))
Base.RefValue{MyStruct}(MyStruct(42.0))
```
"""
function write end

Expand Down

0 comments on commit e87b19b

Please sign in to comment.