feat(phase94): Box→Service conversion with actual registry integration
Phase 94完全達成 - UnifiedBoxRegistryから実際のBoxを取得してServiceに変換 ### 実装成果 - ✅ 6個のAdapter実装(StringBox/Integer/Bool/Array/Map/Console) - ✅ Dummy実装完全削除(38行削減) - ✅ Fail-Fast原則徹底(フォールバック削除) - ✅ テスト7/7 PASS(100%) ### 変更ファイル - src/runtime/core_services.rs: 6個のAdapter実装(+93行) - src/runtime/plugin_host.rs: 実際のBox取得ロジック(+54行)、Dummy削除(-17行) - src/runtime/mod.rs: フォールバック削除(-8行) ### 技術的成果 - Box<dyn NyashBox>を直接保持(型安全性確保) - registry.create_box()で実際のBoxインスタンス取得 - BuiltinBoxFactory登録でcore_required Boxes提供 ### 次のステップ Phase 95: Service traitメソッド実装(Console/String/Array/Map) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@ -5,6 +5,7 @@
|
||||
|
||||
use std::sync::Arc;
|
||||
use crate::runtime::CoreBoxId;
|
||||
use crate::box_trait::NyashBox;
|
||||
|
||||
/// StringBox Service trait
|
||||
pub trait StringService: Send + Sync {
|
||||
@ -80,20 +81,108 @@ impl CoreServices {
|
||||
// Phase 92 以降で各 Service の初期化を検証
|
||||
}
|
||||
|
||||
/// Phase 93: ダミー実装(Phase 94 で削除予定)
|
||||
pub fn dummy() -> Self {
|
||||
use crate::runtime::plugin_host::*;
|
||||
Self {
|
||||
string: Arc::new(DummyStringService),
|
||||
integer: Arc::new(DummyIntegerService),
|
||||
bool: Arc::new(DummyBoolService),
|
||||
array: Arc::new(DummyArrayService),
|
||||
map: Arc::new(DummyMapService),
|
||||
console: Arc::new(DummyConsoleService),
|
||||
}
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// Phase 94: Adapter Pattern - Box → Service 変換
|
||||
// ============================================================================
|
||||
|
||||
/// StringBox → StringService Adapter
|
||||
pub struct StringBoxAdapter {
|
||||
#[allow(dead_code)]
|
||||
inner: Box<dyn NyashBox>,
|
||||
}
|
||||
|
||||
impl StringBoxAdapter {
|
||||
pub fn new(box_instance: Box<dyn NyashBox>) -> Self {
|
||||
Self { inner: box_instance }
|
||||
}
|
||||
}
|
||||
|
||||
impl StringService for StringBoxAdapter {
|
||||
// Phase 95 以降で実装
|
||||
}
|
||||
|
||||
/// IntegerBox → IntegerService Adapter
|
||||
pub struct IntegerBoxAdapter {
|
||||
#[allow(dead_code)]
|
||||
inner: Box<dyn NyashBox>,
|
||||
}
|
||||
|
||||
impl IntegerBoxAdapter {
|
||||
pub fn new(box_instance: Box<dyn NyashBox>) -> Self {
|
||||
Self { inner: box_instance }
|
||||
}
|
||||
}
|
||||
|
||||
impl IntegerService for IntegerBoxAdapter {
|
||||
// Phase 95 以降で実装
|
||||
}
|
||||
|
||||
/// BoolBox → BoolService Adapter
|
||||
pub struct BoolBoxAdapter {
|
||||
#[allow(dead_code)]
|
||||
inner: Box<dyn NyashBox>,
|
||||
}
|
||||
|
||||
impl BoolBoxAdapter {
|
||||
pub fn new(box_instance: Box<dyn NyashBox>) -> Self {
|
||||
Self { inner: box_instance }
|
||||
}
|
||||
}
|
||||
|
||||
impl BoolService for BoolBoxAdapter {
|
||||
// Phase 95 以降で実装
|
||||
}
|
||||
|
||||
/// ArrayBox → ArrayService Adapter
|
||||
pub struct ArrayBoxAdapter {
|
||||
#[allow(dead_code)]
|
||||
inner: Box<dyn NyashBox>,
|
||||
}
|
||||
|
||||
impl ArrayBoxAdapter {
|
||||
pub fn new(box_instance: Box<dyn NyashBox>) -> Self {
|
||||
Self { inner: box_instance }
|
||||
}
|
||||
}
|
||||
|
||||
impl ArrayService for ArrayBoxAdapter {
|
||||
// Phase 95 以降で実装
|
||||
}
|
||||
|
||||
/// MapBox → MapService Adapter
|
||||
pub struct MapBoxAdapter {
|
||||
#[allow(dead_code)]
|
||||
inner: Box<dyn NyashBox>,
|
||||
}
|
||||
|
||||
impl MapBoxAdapter {
|
||||
pub fn new(box_instance: Box<dyn NyashBox>) -> Self {
|
||||
Self { inner: box_instance }
|
||||
}
|
||||
}
|
||||
|
||||
impl MapService for MapBoxAdapter {
|
||||
// Phase 95 以降で実装
|
||||
}
|
||||
|
||||
/// ConsoleBox → ConsoleService Adapter
|
||||
pub struct ConsoleBoxAdapter {
|
||||
#[allow(dead_code)]
|
||||
inner: Box<dyn NyashBox>,
|
||||
}
|
||||
|
||||
impl ConsoleBoxAdapter {
|
||||
pub fn new(box_instance: Box<dyn NyashBox>) -> Self {
|
||||
Self { inner: box_instance }
|
||||
}
|
||||
}
|
||||
|
||||
impl ConsoleService for ConsoleBoxAdapter {
|
||||
// Phase 95 以降で実装
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
Reference in New Issue
Block a user