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 strReference 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 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: NodeIdBack-reference to the CST root node.
Implementations§
Source§impl<'a> CabalFile<'a>
impl<'a> CabalFile<'a>
Sourcepub fn all_dependencies(&self) -> Vec<&Dependency<'a>>
pub fn all_dependencies(&self) -> Vec<&Dependency<'a>>
Collect all dependencies across all components, including conditional blocks.
Sourcepub fn all_components(&self) -> Vec<Component<'a, '_>>
pub fn all_components(&self) -> Vec<Component<'a, '_>>
Return references to all components (library, executables, test suites, benchmarks).
Sourcepub fn find_component(&self, name: &str) -> Option<Component<'a, '_>>
pub fn find_component(&self, name: &str) -> Option<Component<'a, '_>>
Find a component by name.
The unnamed library can be found by passing "library".