Skip to main content

CabalFile

Struct CabalFile 

Source
pub struct CabalFile<'a> {
Show 25 fields pub source: &'a str, pub cabal_version: Option<CabalVersion<'a>>, pub name: Option<&'a str>, pub version: Option<Version>, pub license: Option<&'a str>, pub synopsis: Option<&'a str>, pub description: Option<&'a str>, pub author: Option<&'a str>, pub maintainer: Option<&'a str>, pub homepage: Option<&'a str>, pub bug_reports: Option<&'a str>, pub category: Option<&'a str>, pub build_type: Option<&'a str>, pub tested_with: Option<&'a str>, pub extra_source_files: Vec<&'a str>, pub other_fields: Vec<Field<'a>>, pub common_stanzas: Vec<CommonStanza<'a>>, pub flags: Vec<Flag<'a>>, pub library: Option<Library<'a>>, pub named_libraries: Vec<Library<'a>>, pub executables: Vec<Executable<'a>>, pub test_suites: Vec<TestSuite<'a>>, pub benchmarks: Vec<Benchmark<'a>>, pub source_repositories: Vec<SourceRepository<'a>>, pub cst_root: NodeId,
}
Expand description

The top-level AST for a parsed .cabal file.

Fields§

§source: &'a str

Reference to the source text.

§cabal_version: Option<CabalVersion<'a>>

The cabal-version field.

§name: Option<&'a str>

Package name.

§version: Option<Version>

Package version.

§license: Option<&'a str>

License identifier.

§synopsis: Option<&'a str>

One-line package summary.

§description: Option<&'a str>

Longer package description.

§author: Option<&'a str>

Author name(s).

§maintainer: Option<&'a str>

Maintainer email/name.

§homepage: Option<&'a str>

Package homepage URL.

§bug_reports: Option<&'a str>

Bug tracker URL.

§category: Option<&'a str>

Category string.

§build_type: Option<&'a str>

Build type (Simple, Configure, Make, Custom).

§tested_with: Option<&'a str>

tested-with field.

§extra_source_files: Vec<&'a str>

Extra source files.

§other_fields: Vec<Field<'a>>

Top-level fields not specifically parsed.

§common_stanzas: Vec<CommonStanza<'a>>

common stanzas.

§flags: Vec<Flag<'a>>

flag sections.

§library: Option<Library<'a>>

The unnamed default library (if present).

§named_libraries: Vec<Library<'a>>

Named internal libraries.

§executables: Vec<Executable<'a>>

Executable components.

§test_suites: Vec<TestSuite<'a>>

Test suite components.

§benchmarks: Vec<Benchmark<'a>>

Benchmark components.

§source_repositories: Vec<SourceRepository<'a>>

Source repository sections.

§cst_root: NodeId

Back-reference to the CST root node.

Implementations§

Source§

impl<'a> CabalFile<'a>

Source

pub fn all_dependencies(&self) -> Vec<&Dependency<'a>>

Collect all dependencies across all components, including conditional blocks.

Source

pub fn all_components(&self) -> Vec<Component<'a, '_>>

Return references to all components (library, executables, test suites, benchmarks).

Source

pub fn find_component(&self, name: &str) -> Option<Component<'a, '_>>

Find a component by name.

The unnamed library can be found by passing "library".

Trait Implementations§

Source§

impl<'a> Clone for CabalFile<'a>

Source§

fn clone(&self) -> CabalFile<'a>

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<'a> Debug for CabalFile<'a>

Source§

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

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

impl<'a> PartialEq for CabalFile<'a>

Source§

fn eq(&self, other: &CabalFile<'a>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a> Eq for CabalFile<'a>

Source§

impl<'a> StructuralPartialEq for CabalFile<'a>

Auto Trait Implementations§

§

impl<'a> Freeze for CabalFile<'a>

§

impl<'a> RefUnwindSafe for CabalFile<'a>

§

impl<'a> Send for CabalFile<'a>

§

impl<'a> Sync for CabalFile<'a>

§

impl<'a> Unpin for CabalFile<'a>

§

impl<'a> UnsafeUnpin for CabalFile<'a>

§

impl<'a> UnwindSafe for CabalFile<'a>

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, 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.