diff --git a/src/box_trait.rs b/src/box_trait.rs index c94f247a..84f56136 100644 --- a/src/box_trait.rs +++ b/src/box_trait.rs @@ -87,6 +87,9 @@ pub trait NyashBox: BoxCore + Debug { /// Clone this box (equivalent to Python's copy()) fn clone_box(&self) -> Box; + /// Share this box (state-preserving reference sharing) + fn share_box(&self) -> Box; + /// Arc参照を返す新しいcloneメソッド(参照共有) fn clone_arc(&self) -> SharedNyashBox { Arc::from(self.clone_box()) diff --git a/src/boxes/array/mod.rs b/src/boxes/array/mod.rs index 8566ea37..63842a9b 100644 --- a/src/boxes/array/mod.rs +++ b/src/boxes/array/mod.rs @@ -282,6 +282,11 @@ impl NyashBox for ArrayBox { fn clone_box(&self) -> Box { Box::new(self.clone()) } + + /// 仮実装: clone_boxと同じ(後で修正) + fn share_box(&self) -> Box { + self.clone_box() + } fn to_string_box(&self) -> StringBox { let items = self.items.read().unwrap(); diff --git a/src/boxes/audio_box.rs b/src/boxes/audio_box.rs index b90a5f53..7d8a5bc1 100644 --- a/src/boxes/audio_box.rs +++ b/src/boxes/audio_box.rs @@ -304,6 +304,12 @@ impl BoxCore for AudioBox { impl NyashBox for AudioBox { fn clone_box(&self) -> Box { + + /// 仮実装: clone_boxと同じ(後で修正) + fn share_box(&self) -> Box { + self.clone_box() + } + Box::new(self.clone()) } diff --git a/src/boxes/bool_box.rs b/src/boxes/bool_box.rs index b6c5b46e..25f2cd7b 100644 --- a/src/boxes/bool_box.rs +++ b/src/boxes/bool_box.rs @@ -83,10 +83,17 @@ impl NyashBox for BoolBox { "BoolBox" } + fn clone_box(&self) -> Box { Box::new(self.clone()) } + /// 仮実装: clone_boxと同じ(後で修正) + fn share_box(&self) -> Box { + self.clone_box() + } +} + } diff --git a/src/boxes/buffer/mod.rs b/src/boxes/buffer/mod.rs index 4fa21ec5..d256afe6 100644 --- a/src/boxes/buffer/mod.rs +++ b/src/boxes/buffer/mod.rs @@ -193,6 +193,11 @@ impl NyashBox for BufferBox { fn clone_box(&self) -> Box { Box::new(self.clone()) } + + /// 仮実装: clone_boxと同じ(後で修正) + fn share_box(&self) -> Box { + self.clone_box() + } fn to_string_box(&self) -> StringBox { let data = self.data.read().unwrap(); diff --git a/src/boxes/canvas_event_box.rs b/src/boxes/canvas_event_box.rs index 8298dd9f..4095d2f6 100644 --- a/src/boxes/canvas_event_box.rs +++ b/src/boxes/canvas_event_box.rs @@ -272,6 +272,12 @@ impl BoxCore for CanvasEventBox { impl NyashBox for CanvasEventBox { fn clone_box(&self) -> Box { + + /// 仮実装: clone_boxと同じ(後で修正) + fn share_box(&self) -> Box { + self.clone_box() + } + Box::new(self.clone()) } diff --git a/src/boxes/canvas_loop_box.rs b/src/boxes/canvas_loop_box.rs index 5bda7f1d..3ff1dd2f 100644 --- a/src/boxes/canvas_loop_box.rs +++ b/src/boxes/canvas_loop_box.rs @@ -282,6 +282,12 @@ impl BoxCore for CanvasLoopBox { impl NyashBox for CanvasLoopBox { fn clone_box(&self) -> Box { + + /// 仮実装: clone_boxと同じ(後で修正) + fn share_box(&self) -> Box { + self.clone_box() + } + Box::new(self.clone()) } diff --git a/src/boxes/console_box.rs b/src/boxes/console_box.rs index 44af28f5..f9131bc1 100644 --- a/src/boxes/console_box.rs +++ b/src/boxes/console_box.rs @@ -121,6 +121,12 @@ impl NyashBox for ConsoleBox { } fn clone_box(&self) -> Box { + + /// 仮実装: clone_boxと同じ(後で修正) + fn share_box(&self) -> Box { + self.clone_box() + } + Box::new(self.clone()) } @@ -195,6 +201,12 @@ impl NyashBox for ConsoleBox { } fn clone_box(&self) -> Box { + + /// 仮実装: clone_boxと同じ(後で修正) + fn share_box(&self) -> Box { + self.clone_box() + } + Box::new(self.clone()) } diff --git a/src/boxes/debug_box.rs b/src/boxes/debug_box.rs index 9ecfe059..2a6ac757 100644 --- a/src/boxes/debug_box.rs +++ b/src/boxes/debug_box.rs @@ -377,6 +377,12 @@ impl NyashBox for DebugBox { } fn clone_box(&self) -> Box { + + /// 仮実装: clone_boxと同じ(後で修正) + fn share_box(&self) -> Box { + self.clone_box() + } + Box::new(self.clone()) } diff --git a/src/boxes/egui_box.rs b/src/boxes/egui_box.rs index b791f6b8..0e42d910 100644 --- a/src/boxes/egui_box.rs +++ b/src/boxes/egui_box.rs @@ -154,6 +154,12 @@ impl NyashBox for EguiBox { } fn clone_box(&self) -> Box { + + /// 仮実装: clone_boxと同じ(後で修正) + fn share_box(&self) -> Box { + self.clone_box() + } + Box::new(self.clone()) } diff --git a/src/boxes/file/mod.rs b/src/boxes/file/mod.rs index 98e6ce49..111640f3 100644 --- a/src/boxes/file/mod.rs +++ b/src/boxes/file/mod.rs @@ -134,6 +134,12 @@ impl BoxCore for FileBox { impl NyashBox for FileBox { fn clone_box(&self) -> Box { + + /// 仮実装: clone_boxと同じ(後で修正) + fn share_box(&self) -> Box { + self.clone_box() + } + // Note: Cannot truly clone a File handle, so create a new one to the same path match FileBox::open(&self.path) { Ok(new_file) => Box::new(new_file), diff --git a/src/boxes/future/mod.rs b/src/boxes/future/mod.rs index b817269a..bd916f98 100644 --- a/src/boxes/future/mod.rs +++ b/src/boxes/future/mod.rs @@ -73,6 +73,12 @@ impl NyashFutureBox { impl NyashBox for NyashFutureBox { fn clone_box(&self) -> Box { + + /// 仮実装: clone_boxと同じ(後で修正) + fn share_box(&self) -> Box { + self.clone_box() + } + Box::new(self.clone()) } diff --git a/src/boxes/http/mod.rs b/src/boxes/http/mod.rs index 3b065a05..0f9966d1 100644 --- a/src/boxes/http/mod.rs +++ b/src/boxes/http/mod.rs @@ -49,6 +49,12 @@ impl HttpClientBox { impl NyashBox for HttpClientBox { fn clone_box(&self) -> Box { + + /// 仮実装: clone_boxと同じ(後で修正) + fn share_box(&self) -> Box { + self.clone_box() + } + Box::new(self.clone()) } diff --git a/src/boxes/http_message_box.rs b/src/boxes/http_message_box.rs index 1eb1ace8..6b43dbc5 100644 --- a/src/boxes/http_message_box.rs +++ b/src/boxes/http_message_box.rs @@ -193,6 +193,12 @@ impl HTTPRequestBox { impl NyashBox for HTTPRequestBox { fn clone_box(&self) -> Box { + + /// 仮実装: clone_boxと同じ(後で修正) + fn share_box(&self) -> Box { + self.clone_box() + } + Box::new(self.clone()) } @@ -371,6 +377,12 @@ impl HTTPResponseBox { impl NyashBox for HTTPResponseBox { fn clone_box(&self) -> Box { + + /// 仮実装: clone_boxと同じ(後で修正) + fn share_box(&self) -> Box { + self.clone_box() + } + Box::new(self.clone()) } diff --git a/src/boxes/http_server_box.rs b/src/boxes/http_server_box.rs index b1b39c87..c282cbb1 100644 --- a/src/boxes/http_server_box.rs +++ b/src/boxes/http_server_box.rs @@ -365,6 +365,12 @@ impl HTTPServerBox { impl NyashBox for HTTPServerBox { fn clone_box(&self) -> Box { + + /// 仮実装: clone_boxと同じ(後で修正) + fn share_box(&self) -> Box { + self.clone_box() + } + Box::new(self.clone()) } diff --git a/src/boxes/integer_box.rs b/src/boxes/integer_box.rs index f1a9c44f..5090acac 100644 --- a/src/boxes/integer_box.rs +++ b/src/boxes/integer_box.rs @@ -79,10 +79,17 @@ impl NyashBox for IntegerBox { "IntegerBox" } + fn clone_box(&self) -> Box { Box::new(self.clone()) } + /// 仮実装: clone_boxと同じ(後で修正) + fn share_box(&self) -> Box { + self.clone_box() + } +} + } diff --git a/src/boxes/intent_box.rs b/src/boxes/intent_box.rs index f590fbb8..722dbb9d 100644 --- a/src/boxes/intent_box.rs +++ b/src/boxes/intent_box.rs @@ -97,6 +97,12 @@ impl IntentBox { impl NyashBox for IntentBox { fn clone_box(&self) -> Box { + + /// 仮実装: clone_boxと同じ(後で修正) + fn share_box(&self) -> Box { + self.clone_box() + } + Box::new(self.clone()) } diff --git a/src/boxes/json/mod.rs b/src/boxes/json/mod.rs index 1c789f50..4500ee46 100644 --- a/src/boxes/json/mod.rs +++ b/src/boxes/json/mod.rs @@ -173,6 +173,12 @@ impl std::fmt::Display for JSONBox { impl NyashBox for JSONBox { fn clone_box(&self) -> Box { + + /// 仮実装: clone_boxと同じ(後で修正) + fn share_box(&self) -> Box { + self.clone_box() + } + Box::new(self.clone()) } diff --git a/src/boxes/map_box.rs b/src/boxes/map_box.rs index d2e31be0..974330f8 100644 --- a/src/boxes/map_box.rs +++ b/src/boxes/map_box.rs @@ -269,10 +269,17 @@ impl NyashBox for MapBox { StringBox::new(&format!("MapBox(size={})", size)) } + fn clone_box(&self) -> Box { Box::new(self.clone()) } + /// 仮実装: clone_boxと同じ(後で修正) + fn share_box(&self) -> Box { + self.clone_box() + } +} + fn equals(&self, other: &dyn NyashBox) -> BoolBox { if let Some(other_map) = other.as_any().downcast_ref::() { // 同じインスタンスかチェック(データの共有を考慮) diff --git a/src/boxes/math_box.rs b/src/boxes/math_box.rs index 764285db..25d451a6 100644 --- a/src/boxes/math_box.rs +++ b/src/boxes/math_box.rs @@ -314,6 +314,12 @@ impl NyashBox for MathBox { } fn clone_box(&self) -> Box { + + /// 仮実装: clone_boxと同じ(後で修正) + fn share_box(&self) -> Box { + self.clone_box() + } + Box::new(self.clone()) } @@ -381,6 +387,12 @@ impl NyashBox for FloatBox { } fn clone_box(&self) -> Box { + + /// 仮実装: clone_boxと同じ(後で修正) + fn share_box(&self) -> Box { + self.clone_box() + } + Box::new(self.clone()) } @@ -474,6 +486,12 @@ impl NyashBox for RangeBox { } fn clone_box(&self) -> Box { + + /// 仮実装: clone_boxと同じ(後で修正) + fn share_box(&self) -> Box { + self.clone_box() + } + Box::new(self.clone()) } diff --git a/src/boxes/null_box.rs b/src/boxes/null_box.rs index 8fc54e7c..9201ddef 100644 --- a/src/boxes/null_box.rs +++ b/src/boxes/null_box.rs @@ -166,6 +166,12 @@ impl NyashBox for NullBox { } fn clone_box(&self) -> Box { + + /// 仮実装: clone_boxと同じ(後で修正) + fn share_box(&self) -> Box { + self.clone_box() + } + Box::new(self.clone()) } diff --git a/src/boxes/p2p_box.rs b/src/boxes/p2p_box.rs index dbbf49de..694c95d1 100644 --- a/src/boxes/p2p_box.rs +++ b/src/boxes/p2p_box.rs @@ -153,6 +153,12 @@ impl P2PBox { impl NyashBox for P2PBox { fn clone_box(&self) -> Box { + + /// 仮実装: clone_boxと同じ(後で修正) + fn share_box(&self) -> Box { + self.clone_box() + } + Box::new(self.clone()) } diff --git a/src/boxes/qr_box.rs b/src/boxes/qr_box.rs index 2f43cd14..129aee8e 100644 --- a/src/boxes/qr_box.rs +++ b/src/boxes/qr_box.rs @@ -307,6 +307,12 @@ impl BoxCore for QRBox { impl NyashBox for QRBox { fn clone_box(&self) -> Box { + + /// 仮実装: clone_boxと同じ(後で修正) + fn share_box(&self) -> Box { + self.clone_box() + } + Box::new(self.clone()) } diff --git a/src/boxes/random_box.rs b/src/boxes/random_box.rs index 61bb1f2a..97d79050 100644 --- a/src/boxes/random_box.rs +++ b/src/boxes/random_box.rs @@ -267,6 +267,12 @@ impl NyashBox for RandomBox { } fn clone_box(&self) -> Box { + + /// 仮実装: clone_boxと同じ(後で修正) + fn share_box(&self) -> Box { + self.clone_box() + } + Box::new(self.clone()) } diff --git a/src/boxes/regex/mod.rs b/src/boxes/regex/mod.rs index 8b186df7..b9e5f066 100644 --- a/src/boxes/regex/mod.rs +++ b/src/boxes/regex/mod.rs @@ -83,6 +83,12 @@ impl RegexBox { impl NyashBox for RegexBox { fn clone_box(&self) -> Box { + + /// 仮実装: clone_boxと同じ(後で修正) + fn share_box(&self) -> Box { + self.clone_box() + } + Box::new(self.clone()) } diff --git a/src/boxes/result/mod.rs b/src/boxes/result/mod.rs index 7fe7ce6b..c9f12428 100644 --- a/src/boxes/result/mod.rs +++ b/src/boxes/result/mod.rs @@ -38,6 +38,12 @@ impl NyashResultBox { impl NyashBox for NyashResultBox { fn clone_box(&self) -> Box { + + /// 仮実装: clone_boxと同じ(後で修正) + fn share_box(&self) -> Box { + self.clone_box() + } + match self { NyashResultBox::Ok(val) => Box::new(NyashResultBox::Ok(val.clone_box())), NyashResultBox::Err(err) => Box::new(NyashResultBox::Err(err.clone_box())), diff --git a/src/boxes/simple_intent_box.rs b/src/boxes/simple_intent_box.rs index 4452b8c8..68535677 100644 --- a/src/boxes/simple_intent_box.rs +++ b/src/boxes/simple_intent_box.rs @@ -231,6 +231,12 @@ impl NyashBox for SimpleIntentBox { } fn clone_box(&self) -> Box { + + /// 仮実装: clone_boxと同じ(後で修正) + fn share_box(&self) -> Box { + self.clone_box() + } + Box::new(self.clone()) } diff --git a/src/boxes/socket_box.rs b/src/boxes/socket_box.rs index 792e4052..6e4066a8 100644 --- a/src/boxes/socket_box.rs +++ b/src/boxes/socket_box.rs @@ -384,6 +384,11 @@ impl NyashBox for SocketBox { fn clone_box(&self) -> Box { Box::new(self.clone()) } + + /// 仮実装: clone_boxと同じ(後で修正) + fn share_box(&self) -> Box { + self.clone_box() + } fn to_string_box(&self) -> StringBox { eprintln!("🔥 SOCKETBOX to_string_box() called - Socket ID = {}", self.base.id); diff --git a/src/boxes/sound_box.rs b/src/boxes/sound_box.rs index dd18fd49..bf728681 100644 --- a/src/boxes/sound_box.rs +++ b/src/boxes/sound_box.rs @@ -323,6 +323,12 @@ impl NyashBox for SoundBox { } fn clone_box(&self) -> Box { + + /// 仮実装: clone_boxと同じ(後で修正) + fn share_box(&self) -> Box { + self.clone_box() + } + Box::new(self.clone()) } diff --git a/src/boxes/stream/mod.rs b/src/boxes/stream/mod.rs index c7ae4292..7a7b9788 100644 --- a/src/boxes/stream/mod.rs +++ b/src/boxes/stream/mod.rs @@ -137,6 +137,12 @@ impl NyashStreamBox { impl NyashBox for NyashStreamBox { fn clone_box(&self) -> Box { + + /// 仮実装: clone_boxと同じ(後で修正) + fn share_box(&self) -> Box { + self.clone_box() + } + Box::new(self.clone()) } diff --git a/src/boxes/string_box.rs b/src/boxes/string_box.rs index da9b74ae..91afa3a7 100644 --- a/src/boxes/string_box.rs +++ b/src/boxes/string_box.rs @@ -147,10 +147,17 @@ impl NyashBox for StringBox { "StringBox" } + fn clone_box(&self) -> Box { Box::new(self.clone()) } + /// 仮実装: clone_boxと同じ(後で修正) + fn share_box(&self) -> Box { + self.clone_box() + } +} + } diff --git a/src/boxes/time_box.rs b/src/boxes/time_box.rs index 738239ab..2913dcd1 100644 --- a/src/boxes/time_box.rs +++ b/src/boxes/time_box.rs @@ -197,6 +197,12 @@ impl NyashBox for TimeBox { } fn clone_box(&self) -> Box { + + /// 仮実装: clone_boxと同じ(後で修正) + fn share_box(&self) -> Box { + self.clone_box() + } + Box::new(self.clone()) } @@ -368,6 +374,12 @@ impl NyashBox for DateTimeBox { } fn clone_box(&self) -> Box { + + /// 仮実装: clone_boxと同じ(後で修正) + fn share_box(&self) -> Box { + self.clone_box() + } + Box::new(self.clone()) } @@ -452,6 +464,12 @@ impl NyashBox for TimerBox { } fn clone_box(&self) -> Box { + + /// 仮実装: clone_boxと同じ(後で修正) + fn share_box(&self) -> Box { + self.clone_box() + } + Box::new(self.clone()) } diff --git a/src/boxes/timer_box.rs b/src/boxes/timer_box.rs index b0ecb278..92df343b 100644 --- a/src/boxes/timer_box.rs +++ b/src/boxes/timer_box.rs @@ -215,6 +215,12 @@ impl BoxCore for TimerBox { impl NyashBox for TimerBox { fn clone_box(&self) -> Box { + + /// 仮実装: clone_boxと同じ(後で修正) + fn share_box(&self) -> Box { + self.clone_box() + } + Box::new(self.clone()) } diff --git a/src/boxes/web/web_canvas_box.rs b/src/boxes/web/web_canvas_box.rs index 4fff177a..47469777 100644 --- a/src/boxes/web/web_canvas_box.rs +++ b/src/boxes/web/web_canvas_box.rs @@ -284,6 +284,12 @@ impl BoxCore for WebCanvasBox { #[cfg(target_arch = "wasm32")] impl NyashBox for WebCanvasBox { fn clone_box(&self) -> Box { + + /// 仮実装: clone_boxと同じ(後で修正) + fn share_box(&self) -> Box { + self.clone_box() + } + Box::new(self.clone()) } diff --git a/src/boxes/web/web_console_box.rs b/src/boxes/web/web_console_box.rs index 041478e6..6e0d9c27 100644 --- a/src/boxes/web/web_console_box.rs +++ b/src/boxes/web/web_console_box.rs @@ -161,6 +161,12 @@ impl BoxCore for WebConsoleBox { #[cfg(target_arch = "wasm32")] impl NyashBox for WebConsoleBox { fn clone_box(&self) -> Box { + + /// 仮実装: clone_boxと同じ(後で修正) + fn share_box(&self) -> Box { + self.clone_box() + } + Box::new(self.clone()) } diff --git a/src/boxes/web/web_display_box.rs b/src/boxes/web/web_display_box.rs index 13b8c77f..3b24b865 100644 --- a/src/boxes/web/web_display_box.rs +++ b/src/boxes/web/web_display_box.rs @@ -154,6 +154,12 @@ impl BoxCore for WebDisplayBox { #[cfg(target_arch = "wasm32")] impl NyashBox for WebDisplayBox { fn clone_box(&self) -> Box { + + /// 仮実装: clone_boxと同じ(後で修正) + fn share_box(&self) -> Box { + self.clone_box() + } + Box::new(self.clone()) }