Involved Source Filesclass.gocontext.go
Package precis contains types and functions for the preparation,
enforcement, and comparison of internationalized strings ("PRECIS") as
defined in RFC 8264. It also contains several pre-defined profiles for
passwords, nicknames, and usernames as defined in RFC 8265 and RFC 8266.
BE ADVISED: This package is under construction and the API may change in
backwards incompatible ways and without notice.
nickname.gooptions.goprofile.goprofiles.gotables13.0.0.gotransformer.gotrieval.go
Package-Level Type Names (total 14, in which 3 are exported)
Transformer implements the transform.Transformer interface.
ttransform.Transformer
Bytes returns a new byte slice with the result of applying t to b.
Reset implements the transform.Transformer interface.
String returns a string with the result of applying t to s.
Transform implements the transform.Transformer interface.
T : golang.org/x/text/transform.Transformer
T : vendor/golang.org/x/text/transform.Transformer
func (*Profile).NewTransformer() *Transformer
A class is a set of characters that match certain derived properties. The
PRECIS framework defines two classes: The Freeform class and the Identifier
class. The freeform class should be used for profiles where expressiveness is
prioritized over safety such as nicknames or passwords. The identifier class
should be used for profiles where safety is the first priority such as
addressable network labels and usernames.
validFromproperty
Contains satisfies the runes.Set interface and returns whether the given rune
is a member of the class.
T : golang.org/x/text/runes.Set
var freeform *class
var identifier *class
derivedPropertiesTrie. Total size: 27776 bytes (27.12 KiB). Checksum: c8bfc091c977a4c.
lookup returns the trie value for the first UTF-8 encoding in s and
the width in bytes of this encoding. The size will be 0 if s does not
hold enough bytes to complete the encoding. len(s) must be greater than 0.
lookupString returns the trie value for the first UTF-8 encoding in s and
the width in bytes of this encoding. The size will be 0 if s does not
hold enough bytes to complete the encoding. len(s) must be greater than 0.
lookupStringUnsafe returns the trie value for the first UTF-8 encoding in s.
s must start with a full and valid UTF-8 encoded rune.
lookupUnsafe returns the trie value for the first UTF-8 encoding in s.
s must start with a full and valid UTF-8 encoded rune.
lookupValue determines the type of block n and looks up the value for b.
func newDerivedPropertiesTrie(i int) *derivedPropertiesTrie
var dpTrie *derivedPropertiesTrie
entry is the entry of a trie table
7..6 property (unassigned, disallowed, maybe, valid)
5..0 category
( T) category() category( T) property() property
Transformertransform.Transformer
Reset resets the state and allows a Transformer to be reused.
( T) Span(src []byte, atEOF bool) (n int, err error)
Transform writes to dst the transformed bytes read from src, and
returns the number of dst bytes written and src bytes read. The
atEOF argument tells whether src represents the last bytes of the
input.
Callers should always process the nDst bytes produced and account
for the nSrc bytes consumed before considering the error err.
A nil error means that all of the transformed bytes (whether freshly
transformed from src or left over from previous Transform calls)
were written to dst. A nil error can be returned regardless of
whether atEOF is true. If err is nil then nSrc must equal len(src);
the converse is not necessarily true.
ErrShortDst means that dst was too short to receive all of the
transformed bytes. ErrShortSrc means that src had insufficient data
to complete the transformation. If both conditions apply, then
either error may be returned. Other than the error conditions listed
here, implementations are free to report other errors that arise.
T : golang.org/x/text/transform.SpanningTransformer
T : golang.org/x/text/transform.Transformer
T : vendor/golang.org/x/text/transform.SpanningTransformer
T : vendor/golang.org/x/text/transform.Transformer
Package-Level Functions (total 13, in which 8 are exported)
The AdditionalMapping option defines the additional mapping rule for the
Profile by applying Transformer's in sequence.
The Disallow option further restricts a Profile's allowed characters beyond
what is disallowed by the underlying string class.
The FoldCase option defines a Profile's case mapping rule. Options can be
provided to determine the type of case folding used.
The LowerCase option defines a Profile's case mapping rule. Options can be
provided to determine the type of case folding used.
NewFreeform creates a new PRECIS profile based on the Freeform string class.
Profiles created from this class are suitable for use where expressiveness is
prioritized over safety like passwords, and display-elements such as
nicknames in a chat room.
NewIdentifier creates a new PRECIS profile based on the Identifier string
class. Profiles created from this class are suitable for use where safety is
prioritized over expressiveness like network identifiers, user accounts, chat
rooms, and file names.
NewRestrictedProfile creates a new PRECIS profile based on an existing
profile.
If the parent profile already had the Disallow option set, the new rule
overrides the parents rule.
The Norm option defines a Profile's normalization rule. Defaults to NFC.
Package-Level Variables (total 29, in which 8 are exported)
The BidiRule option causes the Bidi Rule defined in RFC 5893 to be
applied.
The DisallowEmpty option causes the enforcement step to return an error if
the resulting string would be empty.
The FoldWidth option causes the profile to map non-canonical wide and
narrow variants to their decomposition mapping. This is useful for
profiles that are based on the identifier class which would otherwise
disallow such characters.
The IgnoreCase option causes the profile to perform a case insensitive
comparison during the PRECIS comparison step.
Implements the Nickname profile specified in RFC 8266.
Implements the OpaqueString profile defined in RFC 8265 for passwords and
other secure labels.
Implements the UsernameCaseMapped profile specified in RFC 8265.
Implements the UsernameCasePreserved profile specified in RFC 8265.
Special rune types associated with contextual rules defined in
https://tools.ietf.org/html/rfc5892#appendix-A.
ContextO
The pages are generated with Goldsv0.3.2-preview. (GOOS=darwin GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds.