Skip to main content

Function

Struct Function 

Source
pub struct Function<'ctx> { /* private fields */ }
Expand description

A Swift function symbol.

Implementations§

Source§

impl<'ctx> Function<'ctx>

Source

pub fn new(raw: Node<'ctx>) -> Self

Create a Function from a raw node.

Source

pub fn new_static(raw: Node<'ctx>) -> Self

Create a Function from a raw node, marking it as static.

Source

pub fn raw(&self) -> Node<'ctx>

Get the underlying raw node.

Source

pub fn context(&self) -> SymbolContext<'ctx>

Get the context (location) where this function is defined.

Source

pub fn name(&self) -> Option<&'ctx str>

Get the name of this function.

Source

pub fn labels(&self) -> Vec<Option<&'ctx str>>

Get the argument labels for this function.

Returns a vector where each element is Some(label) for labeled parameters and None for unlabeled parameters (using _).

Source

pub fn return_type(&self) -> Option<TypeRef<'ctx>>

Get the return type of this function.

Source

pub fn is_method(&self) -> bool

Check if this is a method (defined in a type context).

Source

pub fn is_static(&self) -> bool

Check if this is a static/class method.

Source

pub fn containing_type(&self) -> Option<&'ctx str>

Get the containing type name if this is a method.

Source

pub fn containing_type_is_class(&self) -> bool

Check if the containing type is a class (reference type).

Source

pub fn containing_type_is_protocol(&self) -> bool

Check if the containing type is a protocol.

Source

pub fn full_name(&self) -> String

Get the full name with labels (e.g., “foo(bar:baz:)”).

Trait Implementations§

Source§

impl<'ctx> Clone for Function<'ctx>

Source§

fn clone(&self) -> Function<'ctx>

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Function<'_>

Source§

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

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

impl Display for Function<'_>

Source§

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

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

impl<'ctx> HasExtensionContext<'ctx> for Function<'ctx>

Source§

fn raw(&self) -> Node<'ctx>

Get the raw node for this symbol.
Source§

fn is_extension(&self) -> bool

Check if this symbol is defined in an extension.
Source§

fn extension_module(&self) -> Option<&'ctx str>

Get the module where the extension is defined, if this is an extension member.
Source§

fn extension_generic_signature(&self) -> Option<GenericSignature<'ctx>>

Get the generic signature from the extension context, if any. Read more
Source§

fn extension_generic_requirements(&self) -> Vec<GenericRequirement<'ctx>>

Get the generic requirements from the extension context, if any.
Source§

impl<'ctx> HasFunctionSignature<'ctx> for Function<'ctx>

Source§

fn signature(&self) -> Option<FunctionType<'ctx>>

Get the function signature (type).
Source§

fn is_async(&self) -> bool

Check if this function is async.
Source§

fn is_throwing(&self) -> bool

Check if this function throws.
Source§

impl<'ctx> HasGenericSignature<'ctx> for Function<'ctx>

Source§

fn generic_signature(&self) -> Option<GenericSignature<'ctx>>

Get the generic signature if this symbol has generic constraints.
Source§

fn generic_requirements(&self) -> Vec<GenericRequirement<'ctx>>

Get the generic requirements (constraints) for this symbol. Read more
Source§

fn is_generic(&self) -> bool

Check if this symbol is generic.
Source§

impl<'ctx> HasModule<'ctx> for Function<'ctx>

Source§

fn module(&self) -> Option<&'ctx str>

Get the module name where this symbol is defined.
Source§

impl<'ctx> Copy for Function<'ctx>

Auto Trait Implementations§

§

impl<'ctx> Freeze for Function<'ctx>

§

impl<'ctx> RefUnwindSafe for Function<'ctx>

§

impl<'ctx> !Send for Function<'ctx>

§

impl<'ctx> !Sync for Function<'ctx>

§

impl<'ctx> Unpin for Function<'ctx>

§

impl<'ctx> UnsafeUnpin for Function<'ctx>

§

impl<'ctx> UnwindSafe for Function<'ctx>

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<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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.