pub struct WorkerManager { /* private fields */ }
Expand description
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§
Source§impl WorkerManager
impl WorkerManager
Sourcepub fn new() -> Self
pub fn new() -> Self
Create new worker manager, internally a new single-threaded executor will be created.
Sourcepub fn with_executor(executor: Arc<Executor<'static>>) -> Self
pub fn with_executor(executor: Arc<Executor<'static>>) -> Self
Create new worker manager, uses externally provided executor.
Sourcepub async fn create_worker(
&self,
worker_settings: WorkerSettings,
) -> Result<Worker>
pub async fn create_worker( &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.
Trait Implementations§
Source§impl Clone for WorkerManager
impl Clone for WorkerManager
Source§fn clone(&self) -> WorkerManager
fn clone(&self) -> WorkerManager
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for WorkerManager
impl Debug for WorkerManager
Auto Trait Implementations§
impl Freeze for WorkerManager
impl !RefUnwindSafe for WorkerManager
impl Send for WorkerManager
impl Sync for WorkerManager
impl Unpin for WorkerManager
impl !UnwindSafe for WorkerManager
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more