From 7cfe8c1193beb54d18efbe7ff5a95a99ab98671a Mon Sep 17 00:00:00 2001 From: tami5 Date: Sun, 19 Jun 2022 06:30:27 +0300 Subject: [PATCH] feat(xcodeproj): deref as pbxproj --- Cargo.toml | 2 +- src/lib.rs | 34 +++------------------------------- 2 files changed, 4 insertions(+), 32 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index d3d6872..e54c4ec 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "xcodeproj" -version = "0.2.4" +version = "0.2.5" edition = "2021" description = "xcodeproj reader and parser." license = "MIT OR Apache-2.0" diff --git a/src/lib.rs b/src/lib.rs index 6f310b3..0c17789 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -6,7 +6,7 @@ #![doc = include_str!("../README.md")] use anyhow::Result; -use pbxproj::{PBXFSReference, PBXObjectCollection, PBXProject, PBXRootObject}; +use pbxproj::PBXRootObject; use std::path::{Path, PathBuf}; mod macros; @@ -14,8 +14,10 @@ pub mod pbxproj; pub mod xcode; /// Main presentation of XCodeProject +#[derive(Debug, derive_deref_rs::Deref)] pub struct XCodeProject { root: PathBuf, + #[deref] pbxproj: PBXRootObject, } @@ -30,34 +32,4 @@ impl XCodeProject { pbxproj: pbxproj_path.try_into()?, }) } - - /// Get archive version - pub fn archive_version(&self) -> u8 { - self.pbxproj.archive_version() - } - - /// Get pbxproj object version - pub fn object_version(&self) -> u8 { - self.pbxproj.object_version() - } - - /// Get root project of pbxproj - pub fn root_project(&self) -> PBXProject { - self.pbxproj.root_project() - } - - /// Get root group of pbxproj - pub fn root_group(&self) -> PBXFSReference { - self.pbxproj.root_group() - } - - /// Get pbxproj objects - pub fn objects(&self) -> &PBXObjectCollection { - self.pbxproj.objects() - } - - /// Get mutable reference of pbxproj objects - pub fn objects_mut(&mut self) -> &mut PBXObjectCollection { - self.pbxproj.objects_mut() - } }