MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / spawn

Function spawn

src/ore/src/task.rs:170–183  ·  view source on GitHub ↗
(_nc: NameClosure, future: Fut)

Source from the content-addressed store, hash-verified

168#[cfg(not(tokio_unstable))]
169#[track_caller]
170pub fn spawn<Fut, Name, NameClosure>(_nc: NameClosure, future: Fut) -> JoinHandle<Fut::Output>
171where
172 Name: AsRef<str>,
173 NameClosure: FnOnce() -> Name,
174 Fut: Future + Send + 'static,
175 Fut::Output: Send + 'static,
176{
177 // Box the future so tokio's task machinery is monomorphized over
178 // `Pin<Box<dyn Future<Output = Fut::Output> + Send>>` per output type,
179 // rather than over every distinct future type at every call site.
180 let future: Pin<Box<dyn Future<Output = Fut::Output> + Send>> = Box::pin(future);
181 #[allow(clippy::disallowed_methods)]
182 JoinHandle::new(tokio::spawn(future))
183}
184
185/// Spawns a new asynchronous task with a name.
186///

Callers 15

connect_materializedFunction · 0.85
clientFunction · 0.85
runFunction · 0.85
render_split_workFunction · 0.85
finishMethod · 0.85
start_new_file_uploadMethod · 0.85
create_instanceMethod · 0.85
spawn_introspection_sinkFunction · 0.85
add_replicaMethod · 0.85
spawnMethod · 0.85
spawnMethod · 0.85

Calls 3

expectMethod · 0.80
spawnMethod · 0.45
nameMethod · 0.45

Tested by 15

connect_materializedFunction · 0.68
spawn_introspection_sinkFunction · 0.68
test_server_errorFunction · 0.68
test_idle_timeoutFunction · 0.68
test_keepaliveFunction · 0.68
test_metricsFunction · 0.68
timeoutFunction · 0.68
test_trigger_channelFunction · 0.68
test_balancerFunction · 0.68