Skip to main content

SliceFile

Struct SliceFile 

Source
pub struct SliceFile {
    pub filename: String,
    pub relative_path: String,
    pub raw_text: String,
    pub module: Option<WeakPtr<Module>>,
    pub attributes: Vec<WeakPtr<Attribute>>,
    pub contents: Vec<Definition>,
    pub is_source: bool,
}

Fields§

§filename: String§relative_path: String§raw_text: String§module: Option<WeakPtr<Module>>§attributes: Vec<WeakPtr<Attribute>>§contents: Vec<Definition>§is_source: bool

Implementations§

Source§

impl SliceFile

Source

pub fn new(relative_path: String, raw_text: String, is_source: bool) -> Self

Source§

impl SliceFile

Source

pub fn visit_with(&self, visitor: &mut impl Visitor)

Visits the SliceFile with the provided visitor.

This function first calls visitor.visit_file, then if the file contains a module declaration it calls visitor.visit_module, and finally it recursively visits any definitions defined in the file.

Trait Implementations§

Source§

impl AsAttributables for SliceFile

Source§

impl Attributable for SliceFile

Source§

fn attributes(&self) -> Vec<&Attribute>

Returns the attributes of the element.
Source§

fn all_attributes(&self) -> Vec<&Attribute>

Returns all the attributes of the element and its parents.
Source§

impl Debug for SliceFile

Source§

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

Formats the value using the given formatter. Read more

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<A> AttributeFunctions for A
where A: Attributable + ?Sized,

Source§

fn has_attribute<T>(&self) -> bool
where T: AttributeKind + 'static,

Returns true if this element has an attribute of the specified type and false otherwise.
Source§

fn find_attribute<T>(&self) -> Option<&T>
where T: AttributeKind + 'static,

Returns the first attribute of the specified type that is applied to this element. If no attributes of the specified type can be found, this returns None.
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.