pub struct ParserPool { /* private fields */ }Expand description
A pool of parse-worker subprocesses.
Implementations§
Source§impl ParserPool
impl ParserPool
Sourcepub fn new(
worker_bin: impl Into<PathBuf>,
size: usize,
timeout: Duration,
) -> Self
pub fn new( worker_bin: impl Into<PathBuf>, size: usize, timeout: Duration, ) -> Self
Create a pool of size workers running worker_bin (the
gonzalo-parse-worker binary), each parse bounded by timeout. Workers
spawn lazily on first use.
Sourcepub fn with_worker_env(self, vars: Vec<(String, String)>) -> Self
pub fn with_worker_env(self, vars: Vec<(String, String)>) -> Self
Set extra environment variables handed to every spawned worker (on top of the inherited environment).
Sourcepub async fn parse(
&self,
language: Language,
source: &str,
) -> Result<CodeGraph, ParseError>
pub async fn parse( &self, language: Language, source: &str, ) -> Result<CodeGraph, ParseError>
Parse source as language into a [CodeGraph] on an isolated worker.
A worker crash is retried once on a fresh worker; a hang past the timeout
is not retried (it may be pathological input that always hangs).
Auto Trait Implementations§
impl !Freeze for ParserPool
impl !RefUnwindSafe for ParserPool
impl Send for ParserPool
impl Sync for ParserPool
impl Unpin for ParserPool
impl UnsafeUnpin for ParserPool
impl !UnwindSafe for ParserPool
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