pub struct RustProject { /* private fields */ }Expand description
A factual Cargo project index rooted at one canonical repository root.
Views are borrowed and deterministically ordered by stable structural keys, so reordering filesystem enumeration cannot change what a caller reads.
Implementations§
Source§impl RustProject
impl RustProject
Sourcepub fn load(
root: &Path,
limits: ResolutionLimits,
) -> Result<Self, RustProjectError>
pub fn load( root: &Path, limits: ResolutionLimits, ) -> Result<Self, RustProjectError>
Read every manifest beneath root and index the project it declares.
Reads Cargo.toml files and directory listings only: no Rust source is
opened and Cargo is never invoked.
Sourcepub fn limits(&self) -> ResolutionLimits
pub fn limits(&self) -> ResolutionLimits
The limits this project was loaded under and retains for snapshots.
Sourcepub fn packages(&self) -> &[RustPackage]
pub fn packages(&self) -> &[RustPackage]
Every package in the project, workspace members and eligible in-root path dependencies alike, ordered by manifest path.
Sourcepub fn workspace_members(&self) -> impl Iterator<Item = &RustPackage>
pub fn workspace_members(&self) -> impl Iterator<Item = &RustPackage>
Only the packages the workspace declares as members.
Sourcepub fn package(&self, id: PackageId) -> Option<&RustPackage>
pub fn package(&self, id: PackageId) -> Option<&RustPackage>
The package an identity issued by this project selects.
Sourcepub fn targets(&self) -> &[RustTarget]
pub fn targets(&self) -> &[RustTarget]
Every target in the project, ordered by package, kind, then name.
Sourcepub fn target(&self, id: TargetId) -> Option<&RustTarget>
pub fn target(&self, id: TargetId) -> Option<&RustTarget>
The target an identity issued by this project selects.
Sourcepub fn package_targets(
&self,
package: PackageId,
) -> impl Iterator<Item = &RustTarget>
pub fn package_targets( &self, package: PackageId, ) -> impl Iterator<Item = &RustTarget>
Every target one package declares.
Sourcepub fn dependencies(&self) -> &[RustDependency]
pub fn dependencies(&self) -> &[RustDependency]
Every dependency edge in the project, ordered by package, kind, then local dependency name.
Sourcepub fn snapshot_target(
&self,
target: TargetId,
) -> Result<RustTargetSnapshot, RustSnapshotError>
pub fn snapshot_target( &self, target: TargetId, ) -> Result<RustTargetSnapshot, RustSnapshotError>
Snapshot only this target’s Rust module closure.
The target’s authority is validated before any source is read, and the closure is all-or-error: a caller receives every reachable source or a typed failure, never a partial set.
Sourcepub fn snapshot_package_primary_targets(
&self,
package: PackageId,
) -> Result<RustPackageSnapshot, RustPackageSnapshotError>
pub fn snapshot_package_primary_targets( &self, package: PackageId, ) -> Result<RustPackageSnapshot, RustPackageSnapshotError>
Snapshot every library, binary, and build-script target of one package.
Target closures remain separate views, but all of them share one source store so an overlapping source is read, hashed, and parsed once. Any incomplete target refuses the entire package snapshot.
Sourcepub fn snapshot_resolution(
&self,
target: TargetId,
) -> Result<RustResolutionSnapshot, RustSnapshotError>
pub fn snapshot_resolution( &self, target: TargetId, ) -> Result<RustResolutionSnapshot, RustSnapshotError>
Snapshot this target together with its same-package library, when Cargo exposes one, and the in-repository dependency libraries its namespace resolves names against.
Sourcepub fn package_dependencies(
&self,
package: PackageId,
) -> impl Iterator<Item = &RustDependency>
pub fn package_dependencies( &self, package: PackageId, ) -> impl Iterator<Item = &RustDependency>
Every dependency edge one package declares.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for RustProject
impl RefUnwindSafe for RustProject
impl Send for RustProject
impl Sync for RustProject
impl Unpin for RustProject
impl UnsafeUnpin for RustProject
impl UnwindSafe for RustProject
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T, R> CollectAndApply<T, R> for T
impl<T, R> CollectAndApply<T, R> for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more