use-go-import 0.0.1

Go import metadata primitives for RustUse
Documentation
1
2
3
4
5
6
7
8
9
10
11
use use_go_import::{GoImportAlias, GoImportKind, GoImportPath, GoImportSpec};

fn main() -> Result<(), use_go_import::GoImportError> {
    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"));
    Ok(())
}