x/model: update docs; make File private for now
This commit is contained in:
parent
c84f9b07b0
commit
0172726a58
@ -79,15 +79,11 @@ const (
|
|||||||
// - Tag: the tag of the model (optional)
|
// - Tag: the tag of the model (optional)
|
||||||
// - Build: the build of the model; usually the quantization or "file type" (optional)
|
// - Build: the build of the model; usually the quantization or "file type" (optional)
|
||||||
//
|
//
|
||||||
// The parts can be obtained in their original form by calling [Name.Parts],
|
// The parts can be obtained in their original form by calling [Name.Parts].
|
||||||
// [Name.Host], [Name.Namespace], [Name.Model], [Name.Tag], and [Name.Build].
|
|
||||||
//
|
//
|
||||||
// To check if a Name has at minimum a valid model part, use [Name.Valid].
|
// To check if a Name has at minimum a valid model part, use [Name.Valid].
|
||||||
//
|
//
|
||||||
// To check if a Name is fully qualified, use [Name.Complete]. A fully
|
// To make a Name by filling in missing parts from another Name, use [Fill].
|
||||||
// qualified name has all parts present.
|
|
||||||
//
|
|
||||||
// To update parts of a Name with defaults, use [Fill].
|
|
||||||
type Name struct {
|
type Name struct {
|
||||||
_ structs.Incomparable
|
_ structs.Incomparable
|
||||||
parts [NumParts]string
|
parts [NumParts]string
|
||||||
@ -231,6 +227,12 @@ var seps = [...]string{
|
|||||||
Build: "",
|
Build: "",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// WriteTo implements io.WriterTo. It writes the fullest possible display
|
||||||
|
// string in form:
|
||||||
|
//
|
||||||
|
// <host>/<namespace>/<model>:<tag>+<build>
|
||||||
|
//
|
||||||
|
// Missing parts and their seperators are not written.
|
||||||
func (r Name) WriteTo(w io.Writer) (n int64, err error) {
|
func (r Name) WriteTo(w io.Writer) (n int64, err error) {
|
||||||
for i := range r.parts {
|
for i := range r.parts {
|
||||||
if r.parts[i] == "" {
|
if r.parts[i] == "" {
|
||||||
@ -379,9 +381,6 @@ func (r Name) Parts() []string {
|
|||||||
//
|
//
|
||||||
// It normalizes the input string by removing "http://" and "https://" only.
|
// It normalizes the input string by removing "http://" and "https://" only.
|
||||||
// No other normalization is done.
|
// No other normalization is done.
|
||||||
//
|
|
||||||
// As a special case, question marks are ignored so they may be used as
|
|
||||||
// placeholders for missing parts in string literals.
|
|
||||||
func NameParts(s string) iter.Seq2[NamePart, string] {
|
func NameParts(s string) iter.Seq2[NamePart, string] {
|
||||||
return func(yield func(NamePart, string) bool) {
|
return func(yield func(NamePart, string) bool) {
|
||||||
if strings.HasPrefix(s, "http://") {
|
if strings.HasPrefix(s, "http://") {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user