Struct jlrs::extensions::multitask::AsyncJulia[][src]

pub struct AsyncJulia<T, R> where
    T: Send + Sync + 'static,
    R: ReturnChannel<T = T>, 
{ /* fields omitted */ }
Expand description

A handle to the async runtime. It can be used to include files and send new tasks. The runtime shuts down when the last handle is dropped. The two generic type parameters T and R are the return type and return channel type respectively, which must be the same across all different implementations of AsyncTask that you use.

The easiest way to get started is to use T = Box<dyn Any + Send + Sync>, the return channel must implement the ReturnChannel trait. This trait is implemented for Sender from async_std and crossbeam_channel.

All initialization methods share two arguments:

  • channel_capacity: the capacity of the channel used to communicate with the runtime.
  • process_events_ms: to ensure the garbage collector can run and tasks that have yielded in Julia are rescheduled, events must be processed periodically when at least one task is running.

Implementations

Initialize Julia in a new thread.

This function will return an error if the JULIA_NUM_THREADS environment variable is not set or set to a value smaller than 3, or if Julia has already been initialized. It is unsafe because this crate provides you with a way to execute arbitrary Julia code which can’t be checked for correctness.

Initialize Julia as a blocking task.

This function will return an error if the JULIA_NUM_THREADS environment variable is not set or set to a value smaller than 3, or if Julia has already been initialized. It is unsafe because this crate provides you with a way to execute arbitrary Julia code which can’t be checked for correctness.

This function is similar to AsyncJulia::init except that it loads a custom system image. A custom image can be generated with the PackageCompiler package for Julia. The main advantage of using a custom image over the default one is that it allows you to avoid much of the compilation overhead often associated with Julia.

In addition to the common arguments to initialize the async runtime, you need to provide julia_bindir and image_path. The first must be the absolute path to a directory that contains a compatible Julia binary (eg ${JULIA_DIR}/bin), the second must be either an absolute or a relative path to a system image.

This function will return an error if either of the two paths doesn’t exist, if the JULIA_NUM_THREADS environment variable is not set or set to a value smaller than 3, or if Julia has already been initialized. It is unsafe because this crate provides you with a way to execute arbitrary Julia code which can’t be checked for correctness.

This function is similar to AsyncJulia::init_async except that it loads a custom system image. A custom image can be generated with the PackageCompiler package for Julia. The main advantage of using a custom image over the default one is that it allows you to avoid much of the compilation overhead often associated with Julia.

In addition to the common arguments to initialize the async runtime, you need to provide julia_bindir and image_path. The first must be the absolute path to a directory that contains a compatible Julia binary (eg ${JULIA_DIR}/bin), the second must be either an absolute or a relative path to a system image.

This function will return an error if either of the two paths doesn’t exist, if the JULIA_NUM_THREADS environment variable is not set or set to a value smaller than 3, or if Julia has already been initialized. It is unsafe because this crate provides you with a way to execute arbitrary Julia code which can’t be checked for correctness.

Send a new task to the runtime, this method waits until there’s room in the channel.

Try to send a new task to the runtime, if there’s no room in the channel an error is returned immediately.

Include a Julia file. This method waits until the call Main.include in Julia has been completed. It returns an error if the path doesn’t exist or the call to Main.include throws an exception.

Include a Julia file. This method waits until the call Main.include in Julia has been completed. It returns an error if the path doesn’t exist, the channel is full, or the call to Main.include throws an exception.

Returns the capacity of the channel.

Returns the number of messages in the channel.

Returns true if the channel is empty.

Returns true if the channel is full.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

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

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

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.