github.com/alexandrestein/gods@v1.0.1/trees/binaryheap/serialization.go (about) 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 5 package binaryheap 6 7 import "github.com/alexandrestein/gods/containers" 8 9 func assertSerializationImplementation() { 10 var _ containers.JSONSerializer = (*Heap)(nil) 11 var _ containers.JSONDeserializer = (*Heap)(nil) 12 } 13 14 // ToJSON outputs the JSON representation of list's elements. 15 func (heap *Heap) ToJSON() ([]byte, error) { 16 return heap.list.ToJSON() 17 } 18 19 // FromJSON populates list's elements from the input JSON representation. 20 func (heap *Heap) FromJSON(data []byte) error { 21 return heap.list.FromJSON(data) 22 }