code: func WithDigest(name Named, digest digest.Digest) (Canonical, error) {
  	if !anchoredDigestRegexp.MatchString(digest.String()) {
  		return nil, ErrDigestInvalidFormat
  	}
  	var repo repository
  	if r, ok := name.(namedRepository); ok {
  		repo.domain = r.Domain()
  		repo.path = r.Path()
  	} else {
  		repo.path = name.Name()
  	}
  	if tagged, ok := name.(Tagged); ok {
  		return reference{
  			namedRepository: repo,
  			tag:             tagged.Tag(),
  			digest:          digest,
  		}, nil
  	}
  	return canonicalReference{
  		namedRepository: repo,
  		digest:          digest,
  	}, nil
  }
docs: // WithDigest combines the name from "name" and the digest from "digest" to form
  // a reference incorporating both the name and the digest.