pub struct SwiftPackageResolvedParser;Expand description
Parses Swift Package Manager lockfiles (Package.resolved).
Extracts pinned dependency versions from Swift Package Manager lockfiles. Supports all three format versions (v1, v2, v3).
§Format Versions
- v1: Legacy format with
object.pinsarray - v2: Standard format with
pinsarray at root - v3: Latest format with
pinsarray and enhanced metadata
§Features
- Extracts package identity, repository URL, version/branch/revision
- Generates namespace from repository URL (e.g., github.com/apple)
- Handles exact versions, branch references, and commit SHAs
§Example
use provenant::parsers::{PackageParser, SwiftPackageResolvedParser};
use std::path::Path;
let path = Path::new("Package.resolved");
let package_data = SwiftPackageResolvedParser::extract_first_package(path);Trait Implementations§
Source§impl PackageParser for SwiftPackageResolvedParser
impl PackageParser for SwiftPackageResolvedParser
Source§const PACKAGE_TYPE: PackageType = PackageType::Swift
const PACKAGE_TYPE: PackageType = PackageType::Swift
Package URL type identifier for this parser (e.g., PackageType::Npm, PackageType::Pypi).
Source§fn is_match(path: &Path) -> bool
fn is_match(path: &Path) -> bool
Checks if the given file path matches this parser’s expected format. Read more
Source§fn extract_packages(path: &Path) -> Vec<PackageData>
fn extract_packages(path: &Path) -> Vec<PackageData>
Extracts all packages from the given file path. Read more
Source§fn extract_first_package(path: &Path) -> PackageData
fn extract_first_package(path: &Path) -> PackageData
Returns the first package from
extract_packages(),
or a default PackageData if the file contains no packages.Auto Trait Implementations§
impl Freeze for SwiftPackageResolvedParser
impl RefUnwindSafe for SwiftPackageResolvedParser
impl Send for SwiftPackageResolvedParser
impl Sync for SwiftPackageResolvedParser
impl Unpin for SwiftPackageResolvedParser
impl UnsafeUnpin for SwiftPackageResolvedParser
impl UnwindSafe for SwiftPackageResolvedParser
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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