🚀 feat: BoxBase+BoxCore革命 Phase4進捗 - 12+Box型統一完了
✅ 完了したBox型統一アーキテクチャ移行 - MathBox関連: MathBox, FloatBox, RangeBox - TimeBox関連: TimeBox, DateTimeBox, TimerBox - DebugBox, RandomBox - StringBox, IntegerBox, BoolBox (個別ファイル版) - ArrayBox, ConsoleBox - box_trait.rs内: StringBox, IntegerBox, BoolBox, VoidBox等 🎯 大幅な進捗達成 - unsafe ID生成 → BoxBase::new()安全化 - コンパイルエラー: 106 → 97に減少 - 統一インターフェース確立でCharmFlow互換性問題完全回避 🔧 革命的変更パターン確立 1. base: BoxBase導入 2. impl BoxCore with box_id()/fmt_box() 3. NyashBoxからbox_id()削除 4. Display::fmt() → fmt_box()委譲 Phase 4E: 残りBox型の統一化継続中 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@ -616,6 +616,16 @@ impl ResultBox {
|
||||
}
|
||||
}
|
||||
|
||||
impl BoxCore for ResultBox {
|
||||
fn box_id(&self) -> u64 {
|
||||
self.base.id
|
||||
}
|
||||
|
||||
fn fmt_box(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||
write!(f, "{}", self.to_string_box().value)
|
||||
}
|
||||
}
|
||||
|
||||
impl NyashBox for ResultBox {
|
||||
fn to_string_box(&self) -> StringBox {
|
||||
if self.is_success {
|
||||
@ -682,15 +692,11 @@ impl NyashBox for ResultBox {
|
||||
fn as_any(&self) -> &dyn Any {
|
||||
self
|
||||
}
|
||||
|
||||
fn box_id(&self) -> u64 {
|
||||
self.id
|
||||
}
|
||||
}
|
||||
|
||||
impl Display for ResultBox {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
write!(f, "{}", self.to_string_box().value)
|
||||
self.fmt_box(f)
|
||||
}
|
||||
}
|
||||
|
||||
@ -798,15 +804,21 @@ impl NyashBox for FutureBox {
|
||||
fn as_any(&self) -> &dyn Any {
|
||||
self
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
impl BoxCore for FutureBox {
|
||||
fn box_id(&self) -> u64 {
|
||||
self.id
|
||||
self.base.id
|
||||
}
|
||||
|
||||
fn fmt_box(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||
write!(f, "{}", self.to_string_box().value)
|
||||
}
|
||||
}
|
||||
|
||||
impl Display for FutureBox {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
write!(f, "{}", self.to_string_box().value)
|
||||
self.fmt_box(f)
|
||||
}
|
||||
}
|
||||
|
||||
@ -816,7 +828,7 @@ impl Display for FutureBox {
|
||||
pub struct AddBox {
|
||||
pub left: Box<dyn NyashBox>,
|
||||
pub right: Box<dyn NyashBox>,
|
||||
id: u64,
|
||||
base: BoxBase,
|
||||
}
|
||||
|
||||
impl AddBox {
|
||||
@ -824,7 +836,7 @@ impl AddBox {
|
||||
Self {
|
||||
left,
|
||||
right,
|
||||
id: next_box_id()
|
||||
base: BoxBase::new(),
|
||||
}
|
||||
}
|
||||
|
||||
@ -911,9 +923,21 @@ impl NyashBox for AddBox {
|
||||
fn as_any(&self) -> &dyn Any {
|
||||
self
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
impl BoxCore for AddBox {
|
||||
fn box_id(&self) -> u64 {
|
||||
self.id
|
||||
self.base.id
|
||||
}
|
||||
|
||||
fn fmt_box(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||
write!(f, "({} + {})", self.left.to_string_box().value, self.right.to_string_box().value)
|
||||
}
|
||||
}
|
||||
|
||||
impl Display for AddBox {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
self.fmt_box(f)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user