Skip to main content

Crate server_less_parse

Crate server_less_parse 

Source
Expand description

Shared parsing utilities for server-less proc macros.

This crate provides common types and functions for extracting method information from impl blocks.

Internal API. This crate exists to support the server-less proc macros and is published only because path dependencies are disallowed. Its surface is typed in terms of syn / proc-macro2 and carries no stability guarantees; depend on the server-less facade instead.

Structs§

GroupRegistry
Registry of declared method groups from #[server(groups(...))].
MethodInfo
Parsed method information with full syn AST types.
ParamInfo
Parsed parameter information
ParsedParamAttrs
Parsed result of #[param(...)] attributes.
PartitionedMethods
Categorized methods for code generation.
ReturnInfo
Parsed return type information

Enums§

HttpMethod
Compile-time HTTP method enum used by proc macros during code generation.
ParamLocation
Parameter location for HTTP requests

Functions§

did_you_mean
Return the closest candidate to input within edit distance ≤ 2, or None.
extract_docs
Extract doc comments from attributes
extract_groups
Extract the group registry from #[server(groups(...))] on an impl block.
extract_iterator_item
Check if a type is impl Iterator<Item=T> and extract T
extract_map_type
Check if a type is HashMap<K, V> or BTreeMap<K, V> and extract K and V
extract_methods
Extract all methods from an impl block
extract_option_type
Check if a type is Option<T> and extract T
extract_result_types
Check if a type is Result<T, E> and extract T and E
extract_stream_item
Check if a type is impl Stream<Item=T> and extract T
extract_vec_type
Check if a type is Vec<T> and extract T
get_impl_name
Get the struct name from an impl block
ident_str
Convert an identifier to a string, stripping the r# prefix for raw identifiers.
is_bool_type
Check if a type is bool
is_id_param
Check if a parameter name looks like an ID
is_option_type
Check if a type is Option<T>
is_unit_type
Check if a type is ()
levenshtein
Compute Levenshtein edit distance between two strings.
parse_param_attrs
Parse #[param(…)] attributes from a parameter
parse_params
Parse function parameters (excluding self)
parse_return_type
Parse return type information
partition_methods
Partition methods into leaf commands, static mounts, and slug mounts.
resolve_method_group
Resolve a method’s group against the registry.
unwrap_option_type
If ty is Option<T>, returns Some(&T). Otherwise returns None.
unwrap_result_ok_type
If ty is Result<T, E>, returns Some(&T). Otherwise returns None.
unwrap_vec_type
If ty is Vec<T>, returns Some(&T). Otherwise returns None.