Skip to main content

Module types_util

Module types_util 

Source
Expand description

Shared syn::Type shape utilities — the Option/Vec/reference peelers and short-name helpers every pipeline stage needs. One definition here replaces the per-module copies that used to live in core::unfold, core::expand, and the jnigen adapter.

Functions§

bare_path_ident
The bare ident of a plain path type (ZThingZThing); None for references, generics, or multi-shape types.
ident
Build an identifier at call-site span.
is_result_type
True when ty is Result<…> (by last path segment).
option_inner_type
If ty is Option<Inner> (by last path segment), return Inner.
pascal_to_snake
Convert a PascalCase / camelCase identifier to snake_case (ZKeyExprz_key_expr). The single implementation behind the public snake_case re-export in the prebindgen-c crate, and behind cbindgen’s type-name mangling.
path_tail_ident
Last path-segment ident of a path type, generics permitting (Option<T>Option, Vec<u8>Vec). Contrast with bare_path_ident, which is None for any generic/non-path shape.
result_ok_type
If ty is Result<T, E>, return T.
result_parts
If ty is Result<T, E> (by last path segment), return (T, E).
vec_inner_type
If ty is Vec<Inner> (by last path segment), return Inner.