gitee.com/quant1x/gox@v1.21.2/util/linkedliststack/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 linkedliststack
     6  
     7  import (
     8  	"gitee.com/quant1x/gox/util/internal"
     9  )
    10  
    11  func assertSerializationImplementation() {
    12  	var _ internal.JSONSerializer = (*Stack)(nil)
    13  	var _ internal.JSONDeserializer = (*Stack)(nil)
    14  }
    15  
    16  // ToJSON outputs the JSON representation of the stack.
    17  func (stack *Stack) ToJSON() ([]byte, error) {
    18  	return stack.list.ToJSON()
    19  }
    20  
    21  // FromJSON populates the stack from the input JSON representation.
    22  func (stack *Stack) FromJSON(data []byte) error {
    23  	return stack.list.FromJSON(data)
    24  }