Skip to main content

ContextComponent

Enum ContextComponent 

Source
pub enum ContextComponent<'ctx> {
    Module(&'ctx str),
    Class {
        name: &'ctx str,
        raw: Node<'ctx>,
    },
    Struct {
        name: &'ctx str,
        raw: Node<'ctx>,
    },
    Enum {
        name: &'ctx str,
        raw: Node<'ctx>,
    },
    Protocol {
        name: &'ctx str,
        raw: Node<'ctx>,
    },
    Extension {
        base: Box<ContextComponent<'ctx>>,
        raw: Node<'ctx>,
    },
    TypeAlias {
        name: &'ctx str,
        raw: Node<'ctx>,
    },
    Other(Node<'ctx>),
}
Expand description

A component in a symbol’s context path.

Variants§

§

Module(&'ctx str)

A module.

§

Class

A class.

Fields

§name: &'ctx str
§raw: Node<'ctx>
§

Struct

A struct.

Fields

§name: &'ctx str
§raw: Node<'ctx>
§

Enum

An enum.

Fields

§name: &'ctx str
§raw: Node<'ctx>
§

Protocol

A protocol.

Fields

§name: &'ctx str
§raw: Node<'ctx>
§

Extension

An extension of another type.

Fields

§base: Box<ContextComponent<'ctx>>
§raw: Node<'ctx>
§

TypeAlias

A type alias.

Fields

§name: &'ctx str
§raw: Node<'ctx>
§

Other(Node<'ctx>)

Other context component.

Implementations§

Source§

impl<'ctx> ContextComponent<'ctx>

Source

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

Get the name of this context component.

Source

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

Get the raw node for this component, if available.

Source

pub fn is_type(&self) -> bool

Check if this component is a type (class, struct, enum, protocol).

Source

pub fn is_extension(&self) -> bool

Check if this component is an extension.

Trait Implementations§

Source§

impl<'ctx> Debug for ContextComponent<'ctx>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'ctx> Freeze for ContextComponent<'ctx>

§

impl<'ctx> RefUnwindSafe for ContextComponent<'ctx>

§

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

§

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

§

impl<'ctx> Unpin for ContextComponent<'ctx>

§

impl<'ctx> UnsafeUnpin for ContextComponent<'ctx>

§

impl<'ctx> UnwindSafe for ContextComponent<'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> 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, 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.