serialization.go 666 B

12345678910111213141516171819202122
  1. // Copyright (c) 2015, Emir Pasic. All rights reserved.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. package binaryheap
  5. import "github.com/emirpasic/gods/containers"
  6. func assertSerializationImplementation() {
  7. var _ containers.JSONSerializer = (*Heap)(nil)
  8. var _ containers.JSONDeserializer = (*Heap)(nil)
  9. }
  10. // ToJSON outputs the JSON representation of list's elements.
  11. func (heap *Heap) ToJSON() ([]byte, error) {
  12. return heap.list.ToJSON()
  13. }
  14. // FromJSON populates list's elements from the input JSON representation.
  15. func (heap *Heap) FromJSON(data []byte) error {
  16. return heap.list.FromJSON(data)
  17. }