Crate enso_macro_utils[][src]

Expand description

A number of helper functions meant to be used in the procedural enso-shapely-macros definitions.

Structs

TypeGatherer

Visitor that accumulates all visited syn::TypePath.

Functions

field_ident_token

Returns token that refers to the field.

field_names

Returns names of the named fields.

fields_list

Collects all fields, named or not.

gather_all_type_reprs

All text representations of TypePaths in the given’s Type subtree.

gather_all_types

All TypePaths in the given’s Type subtree.

identifier_sequence

For given length returns sequence of identifiers like [field0,field1,…].

index_sequence

For given length, returns a sequence of Literals like [0,1,2…]. These are unsuffixed usize literals, so e.g. can be used to identify the tuple unnamed fields.

last_type_arg

Last type argument of the last segment on the type path.

map_tokens

Maps all the tokens in the stream using a given function.

matching_ident

Is the given token an identifier matching to a given string?

new_where_clause

Creates a new where clause from provided sequence of where predicates.

path_matching_ident

Checks if a given Path consists of a single identifier same as given string.

path_segment_generic_args

Obtain list of generic arguments on the path’s segment.

repr

Obtains text representation of given ToTokens-compatible input.

rewrite_stream

Rewrites stream replacing each token with a sequence of tokens returned by the given function. The groups (e.g. token tree within braces) are unpacked, rewritten and repacked into groups – the function is applied recursively.

ty_path_generic_args

Obtain list of generic arguments on the path’s last segment.

ty_path_type_args

Obtain list of type arguments on the path’s last segment.

type_depends_on

Does type depends on the given type parameter.

type_matches

Naive type equality test by comparing their text representations.

type_matches_repr

Naive type equality test by comparing its representation with a string.

variant_depends_on

Does enum variant depend on the given type parameter.

Trait aliases

Str