Skip to main content

ElixirCallTarget

Enum ElixirCallTarget 

Source
#[non_exhaustive]
#[repr(u8)]
pub enum ElixirCallTarget {
Show 29 variants Other = 0, If = 1, Unless = 2, For = 3, While = 4, Case = 5, Cond = 6, With = 7, Try = 8, Receive = 9, Throw = 10, Raise = 11, Reraise = 12, Exit = 13, Def = 14, Defp = 15, Defmacro = 16, Defmacrop = 17, Defmodule = 18, Defprotocol = 19, Defimpl = 20, Defstruct = 21, Defguard = 22, Defguardp = 23, Quote = 24, Alias = 25, Import = 26, Require = 27, Use = 28,
}
Expand description

What a call’s target identifier spells, for every word some consumer tells apart — the raw identity, not a policy reading (#1697). The control-flow rows (Branch, Switch, Loop, Exit) and Member gate on it directly, FuncOpener / Container through the crate’s elixir_declaration projection, and cyclomatic, cognitive, ABC, NPM and NPA branch on it; one call is asked by all of them while the walk visits it, and elixir_call_target answers from the walk’s word slot after the first. Other is every other target — a user function, a remote call, a computed callee, invalid UTF-8 — cached like any answer.

#[repr(u8)] because the slot stores the discriminant; the conversion back is total, reading anything past the table as Other.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Other = 0

Any target that is none of the words below.

§

If = 1

if.

§

Unless = 2

unless.

§

For = 3

for.

§

While = 4

while.

§

Case = 5

case.

§

Cond = 6

cond.

§

With = 7

with.

§

Try = 8

try.

§

Receive = 9

receive.

§

Throw = 10

throw.

§

Raise = 11

raise.

§

Reraise = 12

reraise.

§

Exit = 13

exit.

§

Def = 14

def.

§

Defp = 15

defp.

§

Defmacro = 16

defmacro.

§

Defmacrop = 17

defmacrop.

§

Defmodule = 18

defmodule.

§

Defprotocol = 19

defprotocol.

§

Defimpl = 20

defimpl.

§

Defstruct = 21

defstruct.

§

Defguard = 22

defguard.

§

Defguardp = 23

defguardp.

§

Quote = 24

quote.

§

Alias = 25

alias.

§

Import = 26

import.

§

Require = 27

require.

§

Use = 28

use.

Implementations§

Source§

impl ElixirCallTarget

Source

pub const ALL: [Self; 29]

Every variant, in discriminant order; what a consumer that keys its policy on the word iterates to prove the policy agrees with the rows for all of them.

Source

pub fn from_text(text: &str) -> Self

The word text spells, Other for anything else.

Source

pub fn is_method_macro(self) -> bool

The method-defining macros: def / defp / defmacro / defmacrop.

Source

pub fn is_exit(self) -> bool

The abrupt exits: throw / raise / reraise / exit.

Trait Implementations§

Source§

impl Clone for ElixirCallTarget

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for ElixirCallTarget

Source§

impl Debug for ElixirCallTarget

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for ElixirCallTarget

Source§

impl PartialEq for ElixirCallTarget

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for ElixirCallTarget

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.