// Code generated by "stringer -type=Unit"; DO NOT EDIT.

package units

import (
	"fmt"
	"strconv"
)

const _Unit_name = "PxDpPctRemEmExChVwVhVminVmaxCmMmQInPcPtDotUnitN"

var _Unit_index = [...]uint8{0, 2, 4, 7, 10, 12, 14, 16, 18, 20, 24, 28, 30, 32, 33, 35, 37, 39, 42, 47}

func (i Unit) String() string {
	if i < 0 || i >= Unit(len(_Unit_index)-1) {
		return "Unit(" + strconv.FormatInt(int64(i), 10) + ")"
	}
	return _Unit_name[_Unit_index[i]:_Unit_index[i+1]]
}

func (i *Unit) FromString(s string) error {
	for j := 0; j < len(_Unit_index)-1; j++ {
		if s == _Unit_name[_Unit_index[j]:_Unit_index[j+1]] {
			*i = Unit(j)
			return nil
		}
	}
	return fmt.Errorf("String %v is not a valid option for type Unit", s)
}
