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

pub struct AsyncJulia { /* 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.

All initialization methods share three arguments:

  • max_n_tasks: the maximum number of tasks that can run at the same time.
  • channel_capacity: the capacity of the channel used to communicate with the runtime. If it’s 0 an unbounded channel is used.
  • recv_timeout: timeout used when receiving messages on the communication channel. If no new message is received before the timeout and tasks are running, events are processed.

Implementations

Initialize Julia in a new thread.

This function returns an error if the JULIA_NUM_THREADS environment variable is set to a value smaller than 3 or some invalid value, or if Julia has already been initialized. If the environment variable is not set it’s set to auto. See the struct-level documentation for more info about this method’s arguments.

Safety: this method can race with other crates that try to initialize Julia at the same time.

Initialize Julia as a blocking task.

This function returns an error if the JULIA_NUM_THREADS environment variable is set to a value smaller than 3 or some invalid value, or if Julia has already been initialized. If the environment variable is not set it’s set to auto. See the struct-level documentation for more info about this method’s arguments.

Safety: this method can race with other crates that try to initialize Julia at the same time.

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 returns an error if either of the two paths doesn’t exist, if the JULIA_NUM_THREADS environment variable is set to a value smaller than 3 or some invalid value, or if Julia has already been initialized. If the environment variable is not set it’s set to auto. See the [struct-level] documentation for more info about this method’s arguments.

Safety: this method can race with other crates that try to initialize Julia at the same time.

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 returns an error if either of the two paths doesn’t exist, if the JULIA_NUM_THREADS environment variable is set to a value smaller than 3 or some invalid value, or if Julia has already been initialized. If the environment variable is not set it’s set to auto. See the [struct-level] documentation for more info about this method’s arguments.

Safety: this method can race with other crates that try to initialize Julia at the same time.

Send a new task to the runtime, this method waits if there’s no room in the channel. This method takes two arguments, the task and the sending half of a channel which is used to send the result back after the task has completed.

Try to send a new task to the runtime, if there’s no room in the channel an error is returned immediately. This method takes two arguments, the task and the sending half of a channel which is used to send the result back after the task has completed.

Sends a blocking task to the async runtime, if there’s no room in the channel an error is returned immediately. A blocking task is a closure that takes two arguments, a Global and mutable reference to a GcFrame, and must return a JlrsResult whose inner type is both Send and Sync. This task is executed as soon as possible and can’t call async methods, so it block the runtime. The result of the closure is sent to res_sender.

Sends a blocking task to the async runtime, this method waits if there’s no room in the channel. A blocking task is a closure that takes two arguments, a Global and mutable reference to a GcFrame, and must return a JlrsResult whose inner type is both Send and Sync. This task is executed as soon as possible and can’t call async methods, so it block the runtime. The result of the closure is sent to res_sender.

Sends a blocking task to the async runtime, if there’s no room in the channel an error is returned immediately. A blocking task is a closure that takes two arguments, a Global and mutable reference to a GcFrame, and must return a JlrsResult whose inner type is both Send and Sync. This task is executed as soon as possible and can’t call async methods, so it block the runtime. The result of the closure is sent to res_sender.

Sends a blocking task to the async runtime, this method waits if there’s no room in the channel. A blocking task is a closure that takes two arguments, a Global and mutable reference to a GcFrame, and must return a JlrsResult whose inner type is both Send and Sync. This task is executed as soon as possible and can’t call async methods, so it block the runtime. The result of the closure is sent to res_sender.

Register a task, this method waits if there’s no room in the channel. This method takes one argument, the sending half of a channel which is used to send the result back after the registration has completed.

Try to register a task, if there’s no room in the channel an error is returned immediately. This method takes one argument, the sending half of a channel which is used to send the result back after the registration has completed.

Send a new persistent to the runtime, this method waits if there’s no room in the channel. This method takes a single argument, the task. It returns after PersistentTask::init has been called, a PersistentHandle to the task is returned if this method completes successfully, and the error if it doesn’t.

Send a new persistent to the runtime, if there’s no room in the channel an error is returned immediately. This method takes a single argument, the task. It returns after PersistentTask::init has been called, a PersistentHandle to the task is returned if this method completes successfully, and the error if it doesn’t.

Register a persistent, this method waits if there’s no room in the channel. This method takes one argument, the sending half of a channel which is used to send the result back after the registration has completed.

Try to register a persistent, if there’s no room in the channel an error is returned immediately. This method takes one argument, the sending half of a channel which is used to send the result back after the registration has completed.

Include a Julia file. This method waits until the call to 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.

Enable or disable colored error messages originating from Julia. If this is enabled the error message in JlrsError::Exception can contain ANSI color codes. This feature is disabled by default.

Enable or disable colored error messages originating from Julia. If this is enabled the error message in JlrsError::Exception can contain ANSI color codes. This feature is disabled by default.

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)

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.