The open62541::AsyncClient::shutdown method takes itself by move. Implementing Drop for OpcUaClient, by extension, can't work, since we're only obtaining access to a mutable reference to self. Since we return Arc<Self> from the constructor, both OpcUaClient::start_polling and OpcUaClient::start_subscription both depend on taking weak references to an Arc<Self>. This makes cleanup semantics weird and unclear. While we can implement an internal synchronization of background stream sessions in Drop, the ideal scenario is no synchronization at all, and allowing the background workers to terminate independent of the open62541 client connection.
The
open62541::AsyncClient::shutdownmethod takes itself by move. ImplementingDrop for OpcUaClient, by extension, can't work, since we're only obtaining access to a mutable reference to self. Since we returnArc<Self>from the constructor, bothOpcUaClient::start_pollingandOpcUaClient::start_subscriptionboth depend on taking weak references to anArc<Self>. This makes cleanup semantics weird and unclear. While we can implement an internal synchronization of background stream sessions inDrop, the ideal scenario is no synchronization at all, and allowing the background workers to terminate independent of theopen62541client connection.