Skip to content

Commit d4e6716

Browse files
committed
Remove *_arc methods (#2654)
These are unnecessary. Accepting `impl Into<Arc<T>>` allows passing either `T` or `Arc<T>`.
1 parent 1396d37 commit d4e6716

File tree

1 file changed

+7
-33
lines changed

1 file changed

+7
-33
lines changed

src/client/mod.rs

Lines changed: 7 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -202,31 +202,12 @@ impl ClientBuilder {
202202

203203
/// Sets the voice gateway handler to be used. It will receive voice events sent over the
204204
/// gateway and then consider - based on its settings - whether to dispatch a command.
205-
///
206-
/// *Info*: If a reference to the voice_manager is required for manual dispatch, use the
207-
/// [`Self::voice_manager_arc`]-method instead.
208205
#[cfg(feature = "voice")]
209-
pub fn voice_manager<V>(mut self, voice_manager: V) -> Self
206+
pub fn voice_manager<V>(mut self, voice_manager: impl Into<Arc<V>>) -> Self
210207
where
211208
V: VoiceGatewayManager + 'static,
212209
{
213-
self.voice_manager = Some(Arc::new(voice_manager));
214-
215-
self
216-
}
217-
218-
/// This method allows to pass an [`Arc`]'ed `voice_manager` - this step is done for you in the
219-
/// [`voice_manager`]-method, if you don't need the extra control. You can provide a clone and
220-
/// keep the original to manually dispatch.
221-
///
222-
/// [`voice_manager`]: Self::voice_manager
223-
#[cfg(feature = "voice")]
224-
pub fn voice_manager_arc(
225-
mut self,
226-
voice_manager: Arc<dyn VoiceGatewayManager + 'static>,
227-
) -> Self {
228-
self.voice_manager = Some(voice_manager);
229-
210+
self.voice_manager = Some(voice_manager.into());
230211
self
231212
}
232213

@@ -268,18 +249,11 @@ impl ClientBuilder {
268249
}
269250

270251
/// Adds an event handler with multiple methods for each possible event.
271-
pub fn event_handler<H: EventHandler + 'static>(mut self, event_handler: H) -> Self {
272-
self.event_handlers.push(Arc::new(event_handler));
273-
274-
self
275-
}
276-
277-
/// Adds an event handler with multiple methods for each possible event. Passed by Arc.
278-
pub fn event_handler_arc<H: EventHandler + 'static>(
279-
mut self,
280-
event_handler_arc: Arc<H>,
281-
) -> Self {
282-
self.event_handlers.push(event_handler_arc);
252+
pub fn event_handler<H>(mut self, event_handler: impl Into<Arc<H>>) -> Self
253+
where
254+
H: EventHandler + 'static,
255+
{
256+
self.event_handlers.push(event_handler.into());
283257

284258
self
285259
}

0 commit comments

Comments
 (0)