Skip to main content

Module pkg

Module pkg 

Source
Expand description

Package identity: the one source of every name a generated package uses.

The [package] table of a project’s weaveffi.toml (Package) declares what the library is called and how it is published. The CLI resolves it once into an Identity, and validation builds it into the Model, so the C symbol prefix, the native library name, and every ecosystem’s package, module, and namespace name derive from the same values. Nothing a generator emits is named after WeaveFFI itself, so any number of WeaveFFI-built libraries can coexist in one process and one application.

Structs§

Identity
The resolved identity of the library being bound.
Package
The [package] table of weaveffi.toml.

Constants§

DEFAULT_NAME
Fallback package name for an API that was never given an identity (unit tests and other in-memory uses). The CLI always derives a real one.
DEFAULT_VERSION
Fallback package version when the project omits package.version.

Functions§

c_ident
Lower-snake C identifier form of an arbitrary name: non-alphanumerics collapse to _, and a leading digit gets a lib_ prefix. "my-kv.store" becomes "my_kv_store".
name_from_basename
The file stem of a path-like input name: "path/to/kv.store.yml" becomes "kv".
pascal_ident
UpperCamelCase identifier form of an arbitrary name. Word boundaries are runs of non-alphanumerics; existing camel humps are preserved. "my-kv.store" becomes "MyKvStore".