From 03e8fe7f116dca015629fc45e36ef8a19c7687f9 Mon Sep 17 00:00:00 2001 From: jordancluts <40438956+jordancluts@users.noreply.github.com> Date: Tue, 27 Apr 2021 10:06:08 -0400 Subject: [PATCH] Add Queue `show` method to hide backing Deque I was looking over the Queue method per #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. --- src/queue.jl | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/queue.jl b/src/queue.jl index 7a77e2a99..51bc26fae 100644 --- a/src/queue.jl +++ b/src/queue.jl @@ -45,3 +45,9 @@ Base.iterate(q::Queue, s...) = iterate(q.store, s...) Iterators.reverse(q::Queue) = Iterators.reverse(q.store) Base.:(==)(x::Queue, y::Queue) = x.store == y.store + +# Showing + +function Base.show(io::IO, s::Queue) + print(io,"Queue [$(collect(s.store))]") +end