aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src/package/handle.rs
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-08-07 20:51:59 +0900
committernsfisis <nsfisis@gmail.com>2026-08-07 20:51:59 +0900
commit427e059e4ffc6ce5ff130c803f9e533b7c125089 (patch)
tree96b7c8690bbba0f3238dfe8f52e7fb572dced1e7 /crates/shirabe/src/package/handle.rs
parentae365645730b95d5b01b0df7382b91668d5fa24e (diff)
downloadphp-shirabe-427e059e4ffc6ce5ff130c803f9e533b7c125089.tar.gz
php-shirabe-427e059e4ffc6ce5ff130c803f9e533b7c125089.tar.zst
php-shirabe-427e059e4ffc6ce5ff130c803f9e533b7c125089.zip
feat(plugin): cross alias packages over RPC as proxy stubs
AliasPackage, CompleteAliasPackage and RootAliasPackage now have generated proxy stubs, so a package handed to a plugin no longer has to be a real package: it crosses as the stub matching its concrete variant, answers getAliasOf / setRootPackageAlias / isRootPackageAlias / hasSelfVersionRequires, and can be constructed from plugin code. The setters RootPackageInterface declares are routed through that interface for every root package instead of through the base Package state. Only the alias variant needs it -- RootAliasPackage overrides all nine to write through to the package it aliases -- but a real RootPackage delegates to the same base state either way, so both take one path. An alias of an alias has no representation here, so narrowing the constructor argument to a real package is an explicit error rather than a silent demotion. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/src/package/handle.rs')
-rw-r--r--crates/shirabe/src/package/handle.rs20
1 files changed, 20 insertions, 0 deletions
diff --git a/crates/shirabe/src/package/handle.rs b/crates/shirabe/src/package/handle.rs
index aed8be0f..45d46f49 100644
--- a/crates/shirabe/src/package/handle.rs
+++ b/crates/shirabe/src/package/handle.rs
@@ -76,6 +76,26 @@ impl AnyPackage {
}
}
+ /// For `AliasPackage`'s own methods, which `PackageInterface` does not carry and the
+ /// alias subclasses inherit rather than redeclare.
+ pub fn as_alias_package(&self) -> Option<&AliasPackage> {
+ match self {
+ Self::AliasPackage(p) => Some(p),
+ Self::CompleteAliasPackage(p) => Some(&p.inner),
+ Self::RootAliasPackage(p) => Some(&p.inner.inner),
+ _ => None,
+ }
+ }
+
+ pub fn as_alias_package_mut(&mut self) -> Option<&mut AliasPackage> {
+ match self {
+ Self::AliasPackage(p) => Some(p),
+ Self::CompleteAliasPackage(p) => Some(&mut p.inner),
+ Self::RootAliasPackage(p) => Some(&mut p.inner.inner),
+ _ => None,
+ }
+ }
+
pub fn as_root_package_interface(&self) -> Option<&dyn RootPackageInterface> {
match self {
Self::RootPackage(p) => Some(p),