Skip to main content

Crate use_go_import

Crate use_go_import 

Source
Expand description

§use-go-import

Go import metadata primitives for RustUse.

§Experimental

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

§Example

use use_go_import::{GoImportAlias, GoImportKind, GoImportPath, GoImportSpec};

let path = GoImportPath::new("net/http")?;
let alias = GoImportAlias::new("httpx")?;
let import = GoImportSpec::new(path, GoImportKind::Aliased).with_alias(alias);

assert_eq!(import.path().as_str(), "net/http");
assert_eq!(import.alias().map(GoImportAlias::as_str), Some("httpx"));

§Scope

  • Non-empty Go import paths.
  • Import aliases such as _, ., and ordinary identifiers.
  • Lightweight import kind and group labels.

§Non-goals

  • Import resolution.
  • Package loading.
  • Contacting module registries or proxies.
  • Parsing Go source files.

§License

Licensed under either Apache-2.0 or MIT.

Structs§

GoImportAlias
Validated Go import alias metadata.
GoImportPath
Validated Go import path metadata.
GoImportSpec
Go import specification metadata.

Enums§

GoImportError
Error returned by Go import metadata constructors.
GoImportGroup
Go import group metadata.
GoImportKind
Go import kind metadata.