Botaction use Arc to Clone #64

Open
opened 2024-04-05 13:37:36 -04:00 by modulatingforce · 0 comments

I think at initial design, I was having issues #[derive(Clone)] on BotAction like BotCommand because I really didn't know how to implement the boxed function that's stored.

But when I think about it, that doesn't need to be cloned - it simply needs to be referenced, and the reference can be cloned. So one way this can be handled is to have areas that store this fn box , store an Arc<T> of it . Existing code ofc needs to be adjusted to accommodate , so I want to experiment with that first to see impact , esp for custom developers (if any, some recommendations for custom developers)


Not really a priority, but I think after Routines functionality is put in place, I want to make this a priority so that routines can be cloned if required

I think at initial design, I was having issues `#[derive(Clone)]` on `BotAction` like `BotCommand` because I really didn't know how to implement the boxed function that's stored. But when I think about it, that doesn't need to be cloned - it simply needs to be referenced, and the reference can be cloned. So one way this can be handled is to have areas that store this `fn` box , store an `Arc<T>` of it . Existing code ofc needs to be adjusted to accommodate , so I want to experiment with that first to see impact , esp for custom developers (if any, some recommendations for custom developers) --- Not really a priority, but I think after Routines functionality is put in place, I want to make this a priority so that routines can be cloned if required
modulatingforce added this to the Prototype 1.0 milestone 2024-04-05 13:37:36 -04:00
modulatingforce self-assigned this 2024-04-05 13:37:36 -04:00
modulatingforce added this to the Forcebot Prototype 1.0 Push project 2024-04-05 13:37:37 -04:00
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: modulatingforce/forcebot_rs#64
No description provided.