// Set sets the current position on the cursor c to pos.
Set sets the current position on the cursor c to pos.
// Set sets the current position on the cursor c to pos .
func (c *Cursor) Set(pos *Position) error {
	if pos == nil {
		return errors.New("invalid position")
	}
	pi := -1
	for i, p := range c.ps {
		if p.Equal(&pos.Prefix) {
			pi = i
			break
		}
	}
	if pi == -1 || !c.ps[pi].Contains(pos.IP) {
		return errors.New("position out of range")
	}
	c.set(pi, pos.IP.To16())
	return nil
}
func ( c * Cursor ) Set ( pos * Position ) error { if pos == nil { return errors . New ( " " ) } pi := - 1 for i , p := range c . ps { if p . Equal ( & pos . Prefix ) { pi = i break } } if pi == - 1 || ! c . ps [ pi ] . Contains ( pos . IP ) { return errors . New ( " " ) } c . set ( pi , pos . IP . To16 ( ) ) return nil }
Set sets the current position on the cursor c to pos.
Set sets the current position on the cursor c to pos .