github.com/gnolang/gno@v0.0.0-20240520182011-228e9d0192ce/gnovm/tests/files/ptr7.gno (about)

     1  package main
     2  
     3  import (
     4  	"strings"
     5  
     6  	"github.com/gnolang/gno/_test/net"
     7  )
     8  
     9  type ipNetValue net.IPNet
    10  
    11  func (ipnet *ipNetValue) Set(value string) error {
    12  	_, n, err := net.ParseCIDR(strings.TrimSpace(value))
    13  	if err != nil {
    14  		return err
    15  	}
    16  	*ipnet = ipNetValue(*n)
    17  	return nil
    18  }
    19  
    20  func main() {
    21  	v := ipNetValue{}
    22  	println(v)
    23  }
    24  
    25  // Output:
    26  // (struct{(nil github.com/gnolang/gno/_test/net.IP),(nil github.com/gnolang/gno/_test/net.IPMask)} main.ipNetValue)