aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src/package
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-06-06 15:26:27 +0900
committernsfisis <nsfisis@gmail.com>2026-06-06 15:27:00 +0900
commit165b77b169fbb13a984b6d80f610e3aaa33334e6 (patch)
tree8d690d3c80a8efca2a878541003e30bca9447164 /crates/shirabe/src/package
parent1e7aabcae1b2139aa20a80fbf303c74388933f55 (diff)
downloadphp-shirabe-165b77b169fbb13a984b6d80f610e3aaa33334e6.tar.gz
php-shirabe-165b77b169fbb13a984b6d80f610e3aaa33334e6.tar.zst
php-shirabe-165b77b169fbb13a984b6d80f610e3aaa33334e6.zip
refactor(link): drop phase-b shared-ownership TODO
Link is an immutable value object and is never compared by reference identity, so cloning its fields is faithful to PHP. The shared-ownership TODO does not apply. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/src/package')
-rw-r--r--crates/shirabe/src/package/link.rs29
1 files changed, 2 insertions, 27 deletions
diff --git a/crates/shirabe/src/package/link.rs b/crates/shirabe/src/package/link.rs
index ab1e9c6..946c664 100644
--- a/crates/shirabe/src/package/link.rs
+++ b/crates/shirabe/src/package/link.rs
@@ -1,9 +1,9 @@
//! ref: composer/src/Composer/Package/Link.php
-use shirabe_semver::constraint::AnyConstraint;
-
use crate::package::PackageInterfaceHandle;
+use shirabe_semver::constraint::AnyConstraint;
+#[derive(Clone, Debug)]
pub struct Link {
pub(crate) source: String,
pub(crate) target: String,
@@ -12,31 +12,6 @@ pub struct Link {
pub(crate) pretty_constraint: String,
}
-impl Clone for Link {
- fn clone(&self) -> Self {
- // TODO(phase-b): Link is a PHP class; this clone is a shallow placeholder until
- // Link is shared via Rc<Link>.
- Self {
- source: self.source.clone(),
- target: self.target.clone(),
- constraint: self.constraint.clone(),
- description: self.description.clone(),
- pretty_constraint: self.pretty_constraint.clone(),
- }
- }
-}
-
-impl std::fmt::Debug for Link {
- fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
- f.debug_struct("Link")
- .field("source", &self.source)
- .field("target", &self.target)
- .field("description", &self.description)
- .field("pretty_constraint", &self.pretty_constraint)
- .finish()
- }
-}
-
impl Link {
pub const TYPE_REQUIRE: &'static str = "requires";
pub const TYPE_DEV_REQUIRE: &'static str = "devRequires";