use-go-identifier 0.0.1

ASCII-safe Go identifier primitives for RustUse
Documentation
  • Coverage
  • 70%
    21 out of 30 items documented1 out of 21 items with examples
  • Size
  • Source code size: 13.46 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 694.26 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 3s Average build duration of successful builds.
  • all releases: 3s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • RustUse/use-go
    1 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • CloudBranch

use-go-identifier

ASCII-safe Go identifier primitives for RustUse.

Experimental

use-go-identifier is experimental while use-go remains below 0.3.0.

Example

use use_go_identifier::{GoExportedIdentifier, GoIdentifier, is_valid_ascii_go_identifier};

let identifier = GoIdentifier::new("ServeHTTP")?;
let exported = GoExportedIdentifier::new("ServeHTTP")?;

assert_eq!(identifier.as_str(), "ServeHTTP");
assert_eq!(exported.as_str(), "ServeHTTP");
assert!(is_valid_ascii_go_identifier("handler_1"));
# Ok::<(), use_go_identifier::GoIdentifierError>(())

Scope

  • Ordinary ASCII-safe Go identifier validation.
  • Exported identifiers that start with an uppercase ASCII letter.
  • Unexported identifiers that start with a lowercase ASCII letter or underscore.

Non-goals

  • Complete Unicode Go identifier validation.
  • Keyword or predeclared identifier checks.
  • Go source-code parsing.

Unicode-complete Go identifier validation is future work.

License

Licensed under either Apache-2.0 or MIT.