feat(phase-9.75g-0): Complete BID-FFI Day 3 - FutureBox integration

- Add FutureBox BID bridge implementation for async Box types
- Support FutureBox in box_to_bid_handle conversion
- Add comprehensive FutureBox BID round-trip test
- Update CURRENT_TASK.md to reflect Day 3 completion (100%)

Day 3 fully completed! All Box types (String/Integer/Future) now integrated with BID-FFI.
Everything is Box philosophy proven through unified handle management! 🎉

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Moe Charm
2025-08-17 20:55:49 +09:00
parent a5ff3ecafe
commit ea6cc1fe9e
3 changed files with 75 additions and 1 deletions

View File

@ -3,6 +3,7 @@
// 参考: 既存Boxの設計思想
use crate::box_trait::{NyashBox, StringBox, BoolBox, BoxCore, BoxBase};
use crate::bid::{BidBridge, BidHandle, BidType, BidError, BoxRegistry};
use std::any::Any;
use std::sync::RwLock;
@ -146,6 +147,25 @@ impl std::fmt::Display for NyashFutureBox {
}
}
impl BidBridge for NyashFutureBox {
fn to_bid_handle(&self, registry: &mut BoxRegistry) -> Result<BidHandle, BidError> {
use std::sync::Arc;
let arc_box: Arc<dyn NyashBox> = Arc::new(self.clone());
let handle = registry.register_box(
crate::bid::types::BoxTypeId::FutureBox as u32,
arc_box
);
Ok(handle)
}
fn bid_type(&self) -> BidType {
BidType::Handle {
type_id: crate::bid::types::BoxTypeId::FutureBox as u32,
instance_id: 0 // Will be filled by registry
}
}
}
// Export NyashFutureBox as FutureBox for consistency
pub type FutureBox = NyashFutureBox;