func assignToOptionalType(
	sourceEndpoint *StorageConversionEndpoint,
	destinationEndpoint *StorageConversionEndpoint,
	conversionContext *StorageConversionContext) StorageTypeConversion {
	destinationOptional, destinationIsOptional := AsOptionalType(destinationEndpoint.Type())
	if !destinationIsOptional {
		return nil
	}
	unwrappedEndpoint := destinationEndpoint.WithType(destinationOptional.element)
	conversion, _ := createTypeConversion(sourceEndpoint, unwrappedEndpoint, conversionContext)
	if conversion == nil {
		return nil
	}
	local := destinationEndpoint.CreateLocal("", "Temp")
	return func(reader dst.Expr, writer func(dst.Expr) []dst.Stmt, generationContext *CodeGenerationContext) []dst.Stmt {
		addrOfWriter := func(expr dst.Expr) []dst.Stmt {
			if _, ok := expr.(*dst.Ident); ok {
				return writer(astbuilder.AddrOf(expr))
			}
			assignment := astbuilder.SimpleAssignment(
				dst.NewIdent(local),
				token.DEFINE,
				expr)
			writing := writer(astbuilder.AddrOf(dst.NewIdent(local)))
			return astbuilder.Statements(assignment, writing)
		}
		return conversion(reader, addrOfWriter, generationContext)
	}
}
assignToOptionalType will generate a conversion where the destination is optional, if the
underlying type of the destination is compatible with the source.

<destination> = &<source>
package astmodel
import (
	"go/token"
	"github.com/Azure/k8s-infra/hack/generator/pkg/astbuilder"
	"github.com/dave/dst"
	"github.com/pkg/errors"
)
type StorageTypeConversion func(reader dst.Expr, writer func(dst.Expr) []dst.Stmt, generationContext *CodeGenerationContext) []dst.Stmt
type StorageTypeConversionFactory func(
	source *StorageConversionEndpoint,
	destination *StorageConversionEndpoint,
	conversionContext *StorageConversionContext) StorageTypeConversion
var typeConversionFactories []StorageTypeConversionFactory
func init() {
	typeConversionFactories = []StorageTypeConversionFactory{
		assignPrimitiveTypeFromPrimitiveType,
		assignAliasedPrimitiveTypeFromAliasedPrimitiveType,
		assignArrayFromArray,
		assignMapFromMap,
		assignEnumTypeFromEnumType,
		assignPrimitiveTypeFromEnumType,
		assignObjectTypeFromObjectType,
		assignKnownReferenceFromKnownReference,
		assignFromOptionalType,  
		assignToOptionalType,
		assignToEnumerationType,
		assignFromAliasedPrimitiveType,
		assignToAliasedPrimitiveType,
	}
}
func createTypeConversion(
	sourceEndpoint *StorageConversionEndpoint,
	destinationEndpoint *StorageConversionEndpoint,
	conversionContext *StorageConversionContext) (StorageTypeConversion, error) {
	for _, f := range typeConversionFactories {
		result := f(sourceEndpoint, destinationEndpoint, conversionContext)
		if result != nil {
			return result, nil
		}
	}
	err := errors.Errorf(
		"no conversion found to assign %q from %q",
		destinationEndpoint.name,
		sourceEndpoint.name)
	return nil, err
}