pub struct CCall { /* private fields */ }
Expand description

Use Julia from a Rust function called through ccall.

When you call Rust from Julia through ccall, Julia has already been initialized and trying to initialize it again would cause a crash. In order to still be able to call Julia from Rust and to borrow arrays (if you pass them as Array rather than Ptr{Array}), you’ll need to create a scope first. You can use this struct to do so. It must never be used outside functions called through ccall, and only once for each ccalled function.

If you only need to use a frame to borrow array data, you can use CCall::null_scope. Unlike the runtimes, CCall postpones the allocation of the stack that is used for managing the GC until a GcFrame is created. If a null scope is created, this stack isn’t allocated at all.

Implementations

Create a new CCall. The stack is not allocated until a GcFrame is created.

Safety: This function must never be called outside a function called through ccall from Julia and must only be called once during that call.

Wake the task associated with handle.

The handle must be the handle field of a Base.AsyncCondition in Julia. This can be used to call a long-running Rust function from Julia with ccall in another thread and wait for it to complete in Julia without blocking, an example is available in the repository: ccall_with_threads.

This method is only available if the uv feature is enabled.

Safety: the handle must be acquired from an AsyncCondition.

Create a GcFrame, call the given closure, and return its result.

Create a GcFrame with capacity for at least capacity roots, call the given closure and return its result.

Create a NullFrame and call the given closure.

A NullFrame cannot be nested and cannot store any roots.

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.