Struct mediasoup::worker_manager::WorkerManager [−][src]
Container that creates Worker
instances.
Examples
use futures_lite::future; use mediasoup::worker::WorkerSettings; use mediasoup::worker_manager::WorkerManager; // Create a manager that will use specified binary for spawning new worker thread let worker_manager = WorkerManager::new(); future::block_on(async move { // Create a new worker with default settings let worker = worker_manager .create_worker(WorkerSettings::default()) .await .unwrap(); })
If you already happen to have async_executor::Executor
instance available or need a
multi-threaded executor, WorkerManager::with_executor()
can be used to create an instance
instead.
Implementations
impl WorkerManager
[src]
pub fn new() -> Self
[src]
Create new worker manager, internally a new single-threaded executor will be created.
pub fn with_executor(executor: Arc<Executor<'static>>) -> Self
[src]
Create new worker manager, uses externally provided executor.
pub async fn create_worker(
&self,
worker_settings: WorkerSettings
) -> Result<Worker>
[src]
&self,
worker_settings: WorkerSettings
) -> Result<Worker>
Creates a new worker with the given settings.
Worker manager will be kept alive as long as at least one worker instance is alive.
pub fn on_new_worker<F: Fn(&Worker) + Send + Sync + 'static>(
&self,
callback: F
) -> HandlerId
[src]
&self,
callback: F
) -> HandlerId
Callback is called when a new worker is created.
Trait Implementations
impl Clone for WorkerManager
[src]
fn clone(&self) -> WorkerManager
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for WorkerManager
[src]
impl Default for WorkerManager
[src]
Auto Trait Implementations
impl !RefUnwindSafe for WorkerManager
impl Send for WorkerManager
impl Sync for WorkerManager
impl Unpin for WorkerManager
impl !UnwindSafe for WorkerManager
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,