Expand description
Assorted functions shared by several assists.
ModulesΒ§
- gen_
trait_ πfn_ body - This module contains functions to generate default trait impl function bodies where possible.
- ref_
field_ πexpr - This module contains a helper for converting a field access expression into a path expression. This is used when destructuring a tuple or struct.
StructsΒ§
- Reference
Conversion π
EnumsΒ§
FunctionsΒ§
- add_
group_ πseparators - add_
trait_ assoc_ items_ to_ impl - Given
original_itemsretrieved from the trait definition (usually byfilter_assoc_items()), clones each item for update and applies path transformation to it, then inserts intoimpl_. Returns the modifiedimpl_and the first associated item that got inserted. - check_
pat_ πvariant_ from_ enum - check_
pat_ πvariant_ nested_ or_ literal_ with_ depth - convert_
param_ πlist_ to_ arg_ list - Convert a list of function params to a list of arguments that can be passed into a function call.
- convert_
reference_ πtype - could_
deref_ πto_ target - cover_
edit_ πrange - cover_
let_ πchain - does_
pat_ πmatch_ variant - does_
pat_ πvariant_ nested_ or_ literal - expr_
fill_ πdefault - extract_
trivial_ expression - filter_
assoc_ items - find_
struct_ πimpl find_struct_impllooks for impl of a struct, but this also has additional feature where it takes a list of function names and check if they exist inside impl_, if even one match is found, it returns None.- generate_
impl π - generate_
impl_ πinner - generate_
impl_ πwith_ item - Generates the corresponding
impl Type {}including type and lifetime parameters. - generate_
trait_ πimpl - Generates the corresponding
impl <trait> for Type {}including type and lifetime parameters, with<trait>appended toimplβs generic parametersβ bounds. - generate_
trait_ πimpl_ intransitive - Generates the corresponding
impl <trait> for Type {}including type and lifetime parameters, withimplβs generic parametersβ bounds kept as-is. - generate_
trait_ πimpl_ intransitive_ with_ item - generate_
trait_ πimpl_ with_ item - generic_
param_ πassociated_ bounds - get_
methods π - handle_
as_ πref_ slice - handle_
as_ πref_ str - handle_
copy π - handle_
dereferenced π - handle_
option_ πas_ ref - handle_
result_ πas_ ref - has_
any_ πfn - has_
test_ related_ attribute - insert_
attributes π - invert_
boolean_ πexpression - invert_
special_ πcase - is_
body_ const - is_
never_ πblock - is_
selected π - needs_
parens_ πin_ call - next_
prev π - replace_
record_ πfield_ expr - Replaces the record expression, handling field shorthands including inside macros.
- required_
hashes π - Calculate the number of hashes required for a raw string containing
s - string_
prefix π - Calculate the string literal prefix length
- string_
suffix π - Calculate the string literal suffix length
- test_
related_ attribute_ syn - This is a method with a heuristics to support test methods annotated with custom test annotations, such as
#[test_case(...)],#[tokio::test]and similar. Also a regular#[test]annotation is supported. - trimmed_
text_ πrange - Trim(remove leading and trailing whitespace)
initial_rangeinsource_file, return the trimmed range. - tt_
from_ πsyntax - Creates a token tree list from a syntax node, creating the needed delimited sub token trees. Assumes that the input syntax node is a valid syntax tree.
- unwrap_
trivial_ πblock - vis_
offset π - wrap_
block π - wrap_
paren π - wrap_
paren_ πin_ call