Skip to content

Commit 03e8fe7

Browse files
authored
Add Queue show method to hide backing Deque
I was looking over the Queue method per JuliaCollections#479 and while I didn't find any issues I noticed that during printing at the REPL the backing Deque is printed inside. Decided to try to write a small show method to hide the backing type to pretty it up.
1 parent 0230564 commit 03e8fe7

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/queue.jl

+6
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,9 @@ Base.iterate(q::Queue, s...) = iterate(q.store, s...)
4545
Iterators.reverse(q::Queue) = Iterators.reverse(q.store)
4646

4747
Base.:(==)(x::Queue, y::Queue) = x.store == y.store
48+
49+
# Showing
50+
51+
function Base.show(io::IO, s::Queue)
52+
print(io,"Queue [$(collect(s.store))]")
53+
end

0 commit comments

Comments
 (0)