Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 2 of 2 for ToDec (0.14 sec)

  1. staging/src/k8s.io/apimachinery/pkg/api/resource/quantity.go

    func (q *Quantity) AsInt64() (int64, bool) {
    	if q.d.Dec != nil {
    		return 0, false
    	}
    	return q.i.AsInt64()
    }
    
    // ToDec promotes the quantity in place to use an inf.Dec representation and returns itself.
    func (q *Quantity) ToDec() *Quantity {
    	if q.d.Dec == nil {
    		q.d.Dec = q.i.AsDec()
    		q.i = int64Amount{}
    	}
    	return q
    }
    
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Wed May 29 21:48:10 UTC 2024
    - 23.8K bytes
    - Viewed (0)
  2. staging/src/k8s.io/apimachinery/pkg/api/resource/quantity_test.go

    		{1024 * 1024, BinarySI, "1Mi"},
    	}
    
    	for _, asDec := range []bool{false, true} {
    		for _, item := range table {
    			q := NewQuantity(item.value, item.format)
    			if asDec {
    				q.ToDec()
    			}
    			if e, a := item.expect, q.String(); e != a {
    				t.Errorf("Expected %v, got %v; %#v", e, a, q)
    			}
    			q2, err := ParseQuantity(q.String())
    			if err != nil {
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Wed May 29 21:48:10 UTC 2024
    - 49.4K bytes
    - Viewed (0)
Back to top