queue icon indicating copy to clipboard operation
queue copied to clipboard

advise to support mashal

Open Nyx2022 opened this issue 1 year ago • 2 comments

as the title, i advise this lib can add a feature for mashal and unmashal,thanks a lot !

Nyx2022 avatar Jun 04 '24 00:06 Nyx2022

Hello @Nyx2022, I would like to help but I'm not sure which type of marshalling you are referring to. Do you mean any of the interfaces found in the encoding or encoding/jsonpackages? And which types should implement such interfaces? Thank you!

adrianbrad avatar Jun 11 '24 13:06 adrianbrad

sorry, i can not understand your reply fully, can you describe more

Nyx2022 avatar Jun 12 '24 03:06 Nyx2022

Are you requesting that the queue’s contents be displayed in the output when the queue object is marshaled to JSON? Something like this?

q := queue.NewBlocking([]int{1, 2, 3})
b, _ := json.Marshal(q)
fmt.Println(string(b))
// Output: { "elems": [1, 2, 3]}

adrianbrad avatar Dec 18 '24 08:12 adrianbrad

no, what i want to is only [1,2,3] as the output, not include in "elems" attr

Nyx2022 avatar Dec 18 '24 08:12 Nyx2022