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

Create a new RuntimeBuilder.

initialize Julia on the current thread.

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") };

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

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.