pub struct RuntimeBuilder { /* private fields */ }
Expand description
Build a sync runtime.
With this builder you can set a custom system image by calling RuntimeBuilder::image
,
the builder can be upgraded to an AsyncRuntimeBuilder
by calling
RuntimeBuilder::async_runtime
and providing a backing runtime and channel type. To start
the runtime you must call RuntimeBuilder::start
Implementations
sourceimpl RuntimeBuilder
impl RuntimeBuilder
sourcepub unsafe fn start(self) -> JlrsResult<Julia>
pub unsafe fn start(self) -> JlrsResult<Julia>
initialize Julia on the current thread.
sourcepub fn async_runtime<R, C>(self) -> AsyncRuntimeBuilder<R, C> where
R: AsyncRuntime,
C: Channel<Message>,
pub fn async_runtime<R, C>(self) -> AsyncRuntimeBuilder<R, C> where
R: AsyncRuntime,
C: Channel<Message>,
Upgrade this builder to an AsyncRuntimeBuilder
.
You must provide a backing runtime R
and a backing channel C
. By default, jlrs
supports using tokio and async-std as backing runtimes if the tokio-rt
and
async-std-rt
features are enabled.
For example, if you want to use tokio as the backing runtime and use an unbounded channel:
use jlrs::prelude::*;
let (_julia, _thread_handle) = unsafe { RuntimeBuilder::new()
.async_runtime::<Tokio, UnboundedChannel<_>>()
.start()
.expect("Could not start Julia") };
Smilarly for async-std:
use jlrs::prelude::*;
let (_julia, _thread_handle) = unsafe { RuntimeBuilder::new()
.async_runtime::<AsyncStd, AsyncStdChannel<_>>()
.start()
.expect("Could not start Julia") };
sourcepub fn image<P, Q>(self, julia_bindir: P, image_path: Q) -> Self where
P: AsRef<Path> + Send + 'static,
Q: AsRef<Path> + Send + 'static,
pub fn image<P, Q>(self, julia_bindir: P, image_path: Q) -> Self where
P: AsRef<Path> + Send + 'static,
Q: AsRef<Path> + Send + 'static,
Use a custom system image.
You must provide two arguments to use a custom system image, julia_bindir
and
image_path
. The first is the absolute path to a directory that contains a compatible
Julia binary (eg ${JULIA_DIR}/bin
), the second is the path to a system image.
A custom system image can be created with PackageCompiler
.
Auto Trait Implementations
impl RefUnwindSafe for RuntimeBuilder
impl Send for RuntimeBuilder
impl Sync for RuntimeBuilder
impl Unpin for RuntimeBuilder
impl UnwindSafe for RuntimeBuilder
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more