aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src/dependency_resolver/operation
diff options
context:
space:
mode:
Diffstat (limited to 'crates/shirabe/src/dependency_resolver/operation')
-rw-r--r--crates/shirabe/src/dependency_resolver/operation/install_operation.rs8
-rw-r--r--crates/shirabe/src/dependency_resolver/operation/mark_alias_installed_operation.rs4
-rw-r--r--crates/shirabe/src/dependency_resolver/operation/mark_alias_uninstalled_operation.rs4
-rw-r--r--crates/shirabe/src/dependency_resolver/operation/operation_interface.rs18
-rw-r--r--crates/shirabe/src/dependency_resolver/operation/uninstall_operation.rs8
-rw-r--r--crates/shirabe/src/dependency_resolver/operation/update_operation.rs8
6 files changed, 50 insertions, 0 deletions
diff --git a/crates/shirabe/src/dependency_resolver/operation/install_operation.rs b/crates/shirabe/src/dependency_resolver/operation/install_operation.rs
index 1835636..53b5f99 100644
--- a/crates/shirabe/src/dependency_resolver/operation/install_operation.rs
+++ b/crates/shirabe/src/dependency_resolver/operation/install_operation.rs
@@ -34,6 +34,10 @@ impl SolverOperation for InstallOperation {
}
impl OperationInterface for InstallOperation {
+ fn as_any(&self) -> &dyn std::any::Any {
+ self
+ }
+
fn get_operation_type(&self) -> String {
Self::TYPE.to_string()
}
@@ -45,4 +49,8 @@ impl OperationInterface for InstallOperation {
fn to_string(&self) -> String {
self.show(true)
}
+
+ fn as_install_operation(&self) -> Option<&InstallOperation> {
+ Some(self)
+ }
}
diff --git a/crates/shirabe/src/dependency_resolver/operation/mark_alias_installed_operation.rs b/crates/shirabe/src/dependency_resolver/operation/mark_alias_installed_operation.rs
index e5a7df9..fa6f13d 100644
--- a/crates/shirabe/src/dependency_resolver/operation/mark_alias_installed_operation.rs
+++ b/crates/shirabe/src/dependency_resolver/operation/mark_alias_installed_operation.rs
@@ -25,6 +25,10 @@ impl SolverOperation for MarkAliasInstalledOperation {
}
impl OperationInterface for MarkAliasInstalledOperation {
+ fn as_any(&self) -> &dyn std::any::Any {
+ self
+ }
+
fn get_operation_type(&self) -> String {
Self::TYPE.to_string()
}
diff --git a/crates/shirabe/src/dependency_resolver/operation/mark_alias_uninstalled_operation.rs b/crates/shirabe/src/dependency_resolver/operation/mark_alias_uninstalled_operation.rs
index 21e257d..b9d5d26 100644
--- a/crates/shirabe/src/dependency_resolver/operation/mark_alias_uninstalled_operation.rs
+++ b/crates/shirabe/src/dependency_resolver/operation/mark_alias_uninstalled_operation.rs
@@ -25,6 +25,10 @@ impl SolverOperation for MarkAliasUninstalledOperation {
}
impl OperationInterface for MarkAliasUninstalledOperation {
+ fn as_any(&self) -> &dyn std::any::Any {
+ self
+ }
+
fn get_operation_type(&self) -> String {
Self::TYPE.to_string()
}
diff --git a/crates/shirabe/src/dependency_resolver/operation/operation_interface.rs b/crates/shirabe/src/dependency_resolver/operation/operation_interface.rs
index d93bd0f..f90649d 100644
--- a/crates/shirabe/src/dependency_resolver/operation/operation_interface.rs
+++ b/crates/shirabe/src/dependency_resolver/operation/operation_interface.rs
@@ -1,6 +1,12 @@
//! ref: composer/src/Composer/DependencyResolver/Operation/OperationInterface.php
+use crate::dependency_resolver::operation::install_operation::InstallOperation;
+use crate::dependency_resolver::operation::uninstall_operation::UninstallOperation;
+use crate::dependency_resolver::operation::update_operation::UpdateOperation;
+
pub trait OperationInterface: std::fmt::Debug {
+ fn as_any(&self) -> &dyn std::any::Any;
+
fn get_operation_type(&self) -> String;
fn show(&self, lock: bool) -> String;
@@ -10,4 +16,16 @@ pub trait OperationInterface: std::fmt::Debug {
fn clone_box(&self) -> Box<dyn OperationInterface> {
todo!()
}
+
+ fn as_install_operation(&self) -> Option<&InstallOperation> {
+ None
+ }
+
+ fn as_update_operation(&self) -> Option<&UpdateOperation> {
+ None
+ }
+
+ fn as_uninstall_operation(&self) -> Option<&UninstallOperation> {
+ None
+ }
}
diff --git a/crates/shirabe/src/dependency_resolver/operation/uninstall_operation.rs b/crates/shirabe/src/dependency_resolver/operation/uninstall_operation.rs
index 138a8c8..be7f6f1 100644
--- a/crates/shirabe/src/dependency_resolver/operation/uninstall_operation.rs
+++ b/crates/shirabe/src/dependency_resolver/operation/uninstall_operation.rs
@@ -33,6 +33,10 @@ impl SolverOperation for UninstallOperation {
}
impl OperationInterface for UninstallOperation {
+ fn as_any(&self) -> &dyn std::any::Any {
+ self
+ }
+
fn get_operation_type(&self) -> String {
Self::TYPE.to_string()
}
@@ -44,4 +48,8 @@ impl OperationInterface for UninstallOperation {
fn to_string(&self) -> String {
self.show(true)
}
+
+ fn as_uninstall_operation(&self) -> Option<&UninstallOperation> {
+ Some(self)
+ }
}
diff --git a/crates/shirabe/src/dependency_resolver/operation/update_operation.rs b/crates/shirabe/src/dependency_resolver/operation/update_operation.rs
index c1498ad..9adb248 100644
--- a/crates/shirabe/src/dependency_resolver/operation/update_operation.rs
+++ b/crates/shirabe/src/dependency_resolver/operation/update_operation.rs
@@ -79,6 +79,10 @@ impl SolverOperation for UpdateOperation {
}
impl OperationInterface for UpdateOperation {
+ fn as_any(&self) -> &dyn std::any::Any {
+ self
+ }
+
fn get_operation_type(&self) -> String {
Self::TYPE.to_string()
}
@@ -94,4 +98,8 @@ impl OperationInterface for UpdateOperation {
fn to_string(&self) -> String {
self.show(true)
}
+
+ fn as_update_operation(&self) -> Option<&UpdateOperation> {
+ Some(self)
+ }
}