pub struct Function<'scope, 'data> { /* private fields */ }
Expand description
A Julia function.
Implementations§
Trait Implementations§
Source§impl<'scope, 'data> CCallArg for Function<'scope, 'data>
impl<'scope, 'data> CCallArg for Function<'scope, 'data>
Source§type CCallArgType = Value<'scope, 'data>
type CCallArgType = Value<'scope, 'data>
Type constructor for the type taken by the generated Julia function.
Source§type FunctionArgType = Value<'scope, 'data>
type FunctionArgType = Value<'scope, 'data>
Type constructor for the type taken by the
ccall
ed function.Source§impl<'data> Call<'data> for Function<'_, 'data>
impl<'data> Call<'data> for Function<'_, 'data>
Source§unsafe fn call0<'target, Tgt>(
self,
target: Tgt,
) -> ValueResult<'target, 'data, Tgt>where
Tgt: Target<'target>,
unsafe fn call0<'target, Tgt>(
self,
target: Tgt,
) -> ValueResult<'target, 'data, Tgt>where
Tgt: Target<'target>,
Call a function with no arguments. Read more
Source§unsafe fn call_unchecked<'target, 'value, V, Tgt, const N: usize>(
self,
target: Tgt,
args: V,
) -> ValueData<'target, 'data, Tgt>
unsafe fn call_unchecked<'target, 'value, V, Tgt, const N: usize>( self, target: Tgt, args: V, ) -> ValueData<'target, 'data, Tgt>
Call a function with any number of arguments. Exceptions are not caught. Read more
Source§unsafe fn call1<'target, Tgt>(
self,
target: Tgt,
arg0: Value<'_, 'data>,
) -> ValueResult<'target, 'data, Tgt>where
Tgt: Target<'target>,
unsafe fn call1<'target, Tgt>(
self,
target: Tgt,
arg0: Value<'_, 'data>,
) -> ValueResult<'target, 'data, Tgt>where
Tgt: Target<'target>,
Call a function with one argument. Read more
Source§unsafe fn call2<'target, Tgt>(
self,
target: Tgt,
arg0: Value<'_, 'data>,
arg1: Value<'_, 'data>,
) -> ValueResult<'target, 'data, Tgt>where
Tgt: Target<'target>,
unsafe fn call2<'target, Tgt>(
self,
target: Tgt,
arg0: Value<'_, 'data>,
arg1: Value<'_, 'data>,
) -> ValueResult<'target, 'data, Tgt>where
Tgt: Target<'target>,
Call a function with two arguments. Read more
Source§unsafe fn call3<'target, Tgt>(
self,
target: Tgt,
arg0: Value<'_, 'data>,
arg1: Value<'_, 'data>,
arg2: Value<'_, 'data>,
) -> ValueResult<'target, 'data, Tgt>where
Tgt: Target<'target>,
unsafe fn call3<'target, Tgt>(
self,
target: Tgt,
arg0: Value<'_, 'data>,
arg1: Value<'_, 'data>,
arg2: Value<'_, 'data>,
) -> ValueResult<'target, 'data, Tgt>where
Tgt: Target<'target>,
Call a function with three arguments. Read more
Source§unsafe fn call<'target, 'value, V, Tgt, const N: usize>(
self,
target: Tgt,
args: V,
) -> ValueResult<'target, 'data, Tgt>
unsafe fn call<'target, 'value, V, Tgt, const N: usize>( self, target: Tgt, args: V, ) -> ValueResult<'target, 'data, Tgt>
Call a function with an arbitrary number arguments. Read more
Source§unsafe fn call_tracked<'target, 'value, V, Tgt>(
self,
target: Tgt,
args: V,
) -> JlrsResult<ValueResult<'target, 'data, Tgt>>
unsafe fn call_tracked<'target, 'value, V, Tgt>( self, target: Tgt, args: V, ) -> JlrsResult<ValueResult<'target, 'data, Tgt>>
Call a function with an arbitrary number arguments. Read more
Source§impl<'data> CallAsync<'data> for Function<'_, 'data>
impl<'data> CallAsync<'data> for Function<'_, 'data>
Source§unsafe fn call_async<'target, 'value, 'life0, 'async_trait, V, const N: usize>(
self,
frame: &'life0 mut AsyncGcFrame<'target>,
args: V,
) -> Pin<Box<dyn Future<Output = JuliaResult<'target, 'data>> + 'async_trait>>where
V: Values<'value, 'data, N> + 'async_trait,
Self: 'async_trait,
'target: 'async_trait,
'value: 'async_trait,
'life0: 'async_trait,
unsafe fn call_async<'target, 'value, 'life0, 'async_trait, V, const N: usize>(
self,
frame: &'life0 mut AsyncGcFrame<'target>,
args: V,
) -> Pin<Box<dyn Future<Output = JuliaResult<'target, 'data>> + 'async_trait>>where
V: Values<'value, 'data, N> + 'async_trait,
Self: 'async_trait,
'target: 'async_trait,
'value: 'async_trait,
'life0: 'async_trait,
Creates and schedules a new task with
Base.Threads.@spawn
, and returns a future
that resolves when this task is finished. Read moreSource§unsafe fn call_async_interactive<'target, 'value, 'life0, 'async_trait, V, const N: usize>(
self,
frame: &'life0 mut AsyncGcFrame<'target>,
args: V,
) -> Pin<Box<dyn Future<Output = JuliaResult<'target, 'data>> + 'async_trait>>where
V: Values<'value, 'data, N> + 'async_trait,
Self: 'async_trait,
'target: 'async_trait,
'value: 'async_trait,
'life0: 'async_trait,
unsafe fn call_async_interactive<'target, 'value, 'life0, 'async_trait, V, const N: usize>(
self,
frame: &'life0 mut AsyncGcFrame<'target>,
args: V,
) -> Pin<Box<dyn Future<Output = JuliaResult<'target, 'data>> + 'async_trait>>where
V: Values<'value, 'data, N> + 'async_trait,
Self: 'async_trait,
'target: 'async_trait,
'value: 'async_trait,
'life0: 'async_trait,
Call a function on another thread with the given arguments. This method uses
Base.Threads.@spawn
to call the given function on another thread but return immediately.
While await
ing the result the async runtime can work on other tasks, the current task
resumes after the function call on the other thread completes. Read moreSource§unsafe fn schedule_async_interactive<'target, 'value, V, const N: usize>(
self,
frame: &mut AsyncGcFrame<'target>,
args: V,
) -> JuliaResult<'target, 'data, Value<'target, 'data>>where
V: Values<'value, 'data, N>,
unsafe fn schedule_async_interactive<'target, 'value, V, const N: usize>(
self,
frame: &mut AsyncGcFrame<'target>,
args: V,
) -> JuliaResult<'target, 'data, Value<'target, 'data>>where
V: Values<'value, 'data, N>,
Does the same thing as
CallAsync::call_async
, but the task is returned rather than an
awaitable Future
. This method should only be called in PersistentTask::init
,
otherwise it’s not guaranteed this task can make progress. Read moreSource§unsafe fn schedule_async<'target, 'value, V, const N: usize>(
self,
frame: &mut AsyncGcFrame<'target>,
args: V,
) -> JuliaResult<'target, 'data, Value<'target, 'data>>where
V: Values<'value, 'data, N>,
unsafe fn schedule_async<'target, 'value, V, const N: usize>(
self,
frame: &mut AsyncGcFrame<'target>,
args: V,
) -> JuliaResult<'target, 'data, Value<'target, 'data>>where
V: Values<'value, 'data, N>,
Does the same thing as
CallAsync::call_async
, but the task is returned rather than an
awaitable Future
. This method should only be called in PersistentTask::init
,
otherwise it’s not guaranteed this task can make progress. Read moreSource§unsafe fn call_async_local<'target, 'value, 'life0, 'async_trait, V, const N: usize>(
self,
frame: &'life0 mut AsyncGcFrame<'target>,
args: V,
) -> Pin<Box<dyn Future<Output = JuliaResult<'target, 'data>> + 'async_trait>>where
V: Values<'value, 'data, N> + 'async_trait,
Self: 'async_trait,
'target: 'async_trait,
'value: 'async_trait,
'life0: 'async_trait,
unsafe fn call_async_local<'target, 'value, 'life0, 'async_trait, V, const N: usize>(
self,
frame: &'life0 mut AsyncGcFrame<'target>,
args: V,
) -> Pin<Box<dyn Future<Output = JuliaResult<'target, 'data>> + 'async_trait>>where
V: Values<'value, 'data, N> + 'async_trait,
Self: 'async_trait,
'target: 'async_trait,
'value: 'async_trait,
'life0: 'async_trait,
Call a function with the given arguments in an
@async
block. Like call_async
, the
function is not called on the main thread, but on a separate thread that handles all
tasks created by this method. This method should only be used with functions that do very
little computational work but mostly spend their time waiting on IO. Read moreSource§unsafe fn schedule_async_local<'target, 'value, V, const N: usize>(
self,
frame: &mut AsyncGcFrame<'target>,
args: V,
) -> JuliaResult<'target, 'data, Value<'target, 'data>>where
V: Values<'value, 'data, N>,
unsafe fn schedule_async_local<'target, 'value, V, const N: usize>(
self,
frame: &mut AsyncGcFrame<'target>,
args: V,
) -> JuliaResult<'target, 'data, Value<'target, 'data>>where
V: Values<'value, 'data, N>,
Does the same thing as
CallAsync::call_async_local
, but the task is returned rather
than an awaitable Future
. This method should only be called in PersistentTask::init
,
otherwise it’s not guaranteed this task can make progress. Read moreSource§unsafe fn call_async_main<'target, 'value, 'life0, 'async_trait, V, const N: usize>(
self,
frame: &'life0 mut AsyncGcFrame<'target>,
args: V,
) -> Pin<Box<dyn Future<Output = JuliaResult<'target, 'data>> + 'async_trait>>where
V: Values<'value, 'data, N> + 'async_trait,
Self: 'async_trait,
'target: 'async_trait,
'value: 'async_trait,
'life0: 'async_trait,
unsafe fn call_async_main<'target, 'value, 'life0, 'async_trait, V, const N: usize>(
self,
frame: &'life0 mut AsyncGcFrame<'target>,
args: V,
) -> Pin<Box<dyn Future<Output = JuliaResult<'target, 'data>> + 'async_trait>>where
V: Values<'value, 'data, N> + 'async_trait,
Self: 'async_trait,
'target: 'async_trait,
'value: 'async_trait,
'life0: 'async_trait,
Call a function with the given arguments in an
@async
block. The task is scheduled on
the main thread. This method should only be used with functions that must run on the main
thread. The runtime is blocked while this task is active. Read moreSource§unsafe fn schedule_async_main<'target, 'value, V, const N: usize>(
self,
frame: &mut AsyncGcFrame<'target>,
args: V,
) -> JuliaResult<'target, 'data, Value<'target, 'data>>where
V: Values<'value, 'data, N>,
unsafe fn schedule_async_main<'target, 'value, V, const N: usize>(
self,
frame: &mut AsyncGcFrame<'target>,
args: V,
) -> JuliaResult<'target, 'data, Value<'target, 'data>>where
V: Values<'value, 'data, N>,
Does the same thing as
CallAsync::call_async_main
, but the task is returned rather
than an awaitable Future
. This method should only be called in PersistentTask::init
,
otherwise it’s not guaranteed this task can make progress. Read moreSource§unsafe fn call_async_tracked<'target, 'value, 'life0, 'async_trait, V, const N: usize>(
self,
frame: &'life0 mut AsyncGcFrame<'target>,
args: V,
) -> Pin<Box<dyn Future<Output = JlrsResult<JuliaResult<'target, 'data>>> + 'async_trait>>where
V: Values<'value, 'data, N> + 'async_trait,
Self: 'async_trait,
'target: 'async_trait,
'value: 'async_trait,
'life0: 'async_trait,
unsafe fn call_async_tracked<'target, 'value, 'life0, 'async_trait, V, const N: usize>(
self,
frame: &'life0 mut AsyncGcFrame<'target>,
args: V,
) -> Pin<Box<dyn Future<Output = JlrsResult<JuliaResult<'target, 'data>>> + 'async_trait>>where
V: Values<'value, 'data, N> + 'async_trait,
Self: 'async_trait,
'target: 'async_trait,
'value: 'async_trait,
'life0: 'async_trait,
Creates and schedules a new task with
Base.Threads.@spawn
, and returns a future
that resolves when this task is finished. Read moreSource§unsafe fn schedule_async_tracked<'target, 'value, V, Tgt, const N: usize>(
self,
frame: &mut AsyncGcFrame<'target>,
args: V,
) -> JlrsResult<JuliaResult<'target, 'data, Value<'target, 'data>>>
unsafe fn schedule_async_tracked<'target, 'value, V, Tgt, const N: usize>( self, frame: &mut AsyncGcFrame<'target>, args: V, ) -> JlrsResult<JuliaResult<'target, 'data, Value<'target, 'data>>>
Does the same thing as
CallAsync::call_async
, but the task is returned rather than an
awaitable Future
. This method should only be called in PersistentTask::init
,
otherwise it’s not guaranteed this task can make progress. Read moreSource§unsafe fn call_async_interactive_tracked<'target, 'value, 'life0, 'async_trait, V, const N: usize>(
self,
frame: &'life0 mut AsyncGcFrame<'target>,
args: V,
) -> Pin<Box<dyn Future<Output = JlrsResult<JuliaResult<'target, 'data>>> + 'async_trait>>where
V: Values<'value, 'data, N> + 'async_trait,
Self: 'async_trait,
'target: 'async_trait,
'value: 'async_trait,
'life0: 'async_trait,
unsafe fn call_async_interactive_tracked<'target, 'value, 'life0, 'async_trait, V, const N: usize>(
self,
frame: &'life0 mut AsyncGcFrame<'target>,
args: V,
) -> Pin<Box<dyn Future<Output = JlrsResult<JuliaResult<'target, 'data>>> + 'async_trait>>where
V: Values<'value, 'data, N> + 'async_trait,
Self: 'async_trait,
'target: 'async_trait,
'value: 'async_trait,
'life0: 'async_trait,
Call a function on another thread with the given arguments. This method uses
Base.Threads.@spawn
to call the given function on another thread but return immediately.
While await
ing the result the async runtime can work on other tasks, the current task
resumes after the function call on the other thread completes. Read moreSource§unsafe fn schedule_async_interactive_tracked<'target, 'value, V, Tgt, const N: usize>(
self,
frame: &mut AsyncGcFrame<'target>,
args: V,
) -> JlrsResult<JuliaResult<'target, 'data, Value<'target, 'data>>>
unsafe fn schedule_async_interactive_tracked<'target, 'value, V, Tgt, const N: usize>( self, frame: &mut AsyncGcFrame<'target>, args: V, ) -> JlrsResult<JuliaResult<'target, 'data, Value<'target, 'data>>>
Does the same thing as
CallAsync::call_async
, but the task is returned rather than an
awaitable Future
. This method should only be called in PersistentTask::init
,
otherwise it’s not guaranteed this task can make progress. Read moreSource§unsafe fn call_async_local_tracked<'target, 'value, 'life0, 'async_trait, V, const N: usize>(
self,
frame: &'life0 mut AsyncGcFrame<'target>,
args: V,
) -> Pin<Box<dyn Future<Output = JlrsResult<JuliaResult<'target, 'data>>> + 'async_trait>>where
V: Values<'value, 'data, N> + 'async_trait,
Self: 'async_trait,
'target: 'async_trait,
'value: 'async_trait,
'life0: 'async_trait,
unsafe fn call_async_local_tracked<'target, 'value, 'life0, 'async_trait, V, const N: usize>(
self,
frame: &'life0 mut AsyncGcFrame<'target>,
args: V,
) -> Pin<Box<dyn Future<Output = JlrsResult<JuliaResult<'target, 'data>>> + 'async_trait>>where
V: Values<'value, 'data, N> + 'async_trait,
Self: 'async_trait,
'target: 'async_trait,
'value: 'async_trait,
'life0: 'async_trait,
Call a function with the given arguments in an
@async
block. Like call_async
, the
function is not called on the main thread, but on a separate thread that handles all
tasks created by this method. This method should only be used with functions that do very
little computational work but mostly spend their time waiting on IO. Read moreSource§unsafe fn schedule_async_local_tracked<'target, 'value, V, Tgt, const N: usize>(
self,
frame: &mut AsyncGcFrame<'target>,
args: V,
) -> JlrsResult<JuliaResult<'target, 'data, Value<'target, 'data>>>
unsafe fn schedule_async_local_tracked<'target, 'value, V, Tgt, const N: usize>( self, frame: &mut AsyncGcFrame<'target>, args: V, ) -> JlrsResult<JuliaResult<'target, 'data, Value<'target, 'data>>>
Does the same thing as
CallAsync::call_async_local
, but the task is returned rather
than an awaitable Future
. This method should only be called in PersistentTask::init
,
otherwise it’s not guaranteed this task can make progress. Read moreSource§unsafe fn call_async_main_tracked<'target, 'value, 'life0, 'async_trait, V, const N: usize>(
self,
frame: &'life0 mut AsyncGcFrame<'target>,
args: V,
) -> Pin<Box<dyn Future<Output = JlrsResult<JuliaResult<'target, 'data>>> + 'async_trait>>where
V: Values<'value, 'data, N> + 'async_trait,
Self: 'async_trait,
'target: 'async_trait,
'value: 'async_trait,
'life0: 'async_trait,
unsafe fn call_async_main_tracked<'target, 'value, 'life0, 'async_trait, V, const N: usize>(
self,
frame: &'life0 mut AsyncGcFrame<'target>,
args: V,
) -> Pin<Box<dyn Future<Output = JlrsResult<JuliaResult<'target, 'data>>> + 'async_trait>>where
V: Values<'value, 'data, N> + 'async_trait,
Self: 'async_trait,
'target: 'async_trait,
'value: 'async_trait,
'life0: 'async_trait,
Call a function with the given arguments in an
@async
block. The task is scheduled on
the main thread. This method should only be used with functions that must run on the main
thread. The runtime is blocked while this task is active. Read moreSource§unsafe fn schedule_async_main_tracked<'target, 'value, V, Tgt, const N: usize>(
self,
frame: &mut AsyncGcFrame<'target>,
args: V,
) -> JlrsResult<JuliaResult<'target, 'data, Value<'target, 'data>>>
unsafe fn schedule_async_main_tracked<'target, 'value, V, Tgt, const N: usize>( self, frame: &mut AsyncGcFrame<'target>, args: V, ) -> JlrsResult<JuliaResult<'target, 'data, Value<'target, 'data>>>
Does the same thing as
CallAsync::call_async_main
, but the task is returned rather
than an awaitable Future
. This method should only be called in PersistentTask::init
,
otherwise it’s not guaranteed this task can make progress. Read moreSource§impl ConstructType for Function<'_, '_>
impl ConstructType for Function<'_, '_>
Source§type Static = Function<'static, 'static>
type Static = Function<'static, 'static>
Self
, but with all lifetimes set to 'static
. This ensures Self::Static
has a type
id.Source§fn construct_type_uncached<'target, Tgt>(
target: Tgt,
) -> ValueData<'target, 'static, Tgt>where
Tgt: Target<'target>,
fn construct_type_uncached<'target, Tgt>(
target: Tgt,
) -> ValueData<'target, 'static, Tgt>where
Tgt: Target<'target>,
Constructs the type object associated with this type.
Source§fn base_type<'target, Tgt>(target: &Tgt) -> Option<Value<'target, 'static>>where
Tgt: Target<'target>,
fn base_type<'target, Tgt>(target: &Tgt) -> Option<Value<'target, 'static>>where
Tgt: Target<'target>,
Returns the base type object associated with this type. Read more
Source§fn construct_type_with_env_uncached<'target, Tgt>(
target: Tgt,
_env: &TypeVarEnv<'_>,
) -> ValueData<'target, 'static, Tgt>where
Tgt: Target<'target>,
fn construct_type_with_env_uncached<'target, Tgt>(
target: Tgt,
_env: &TypeVarEnv<'_>,
) -> ValueData<'target, 'static, Tgt>where
Tgt: Target<'target>,
Constructs the type object associated with this type. Read more
Source§fn construct_type<'target, Tgt>(target: Tgt) -> ValueData<'target, 'static, Tgt>where
Tgt: Target<'target>,
fn construct_type<'target, Tgt>(target: Tgt) -> ValueData<'target, 'static, Tgt>where
Tgt: Target<'target>,
Construct the type object and try to cache the result. If a cached entry is available, it
is returned.
Source§fn construct_type_with_env<'target, Tgt>(
target: Tgt,
env: &TypeVarEnv<'_>,
) -> ValueData<'target, 'static, Tgt>where
Tgt: Target<'target>,
fn construct_type_with_env<'target, Tgt>(
target: Tgt,
env: &TypeVarEnv<'_>,
) -> ValueData<'target, 'static, Tgt>where
Tgt: Target<'target>,
Construct the type object with an environment of
TypeVar
s and try to cache the result.
If a cached entry is available, it is returned. Read moreSource§impl<'value, 'data> ProvideKeywords<'value, 'data> for Function<'value, 'data>
impl<'value, 'data> ProvideKeywords<'value, 'data> for Function<'value, 'data>
Source§fn provide_keywords(
self,
kws: Value<'value, 'data>,
) -> JlrsResult<WithKeywords<'value, 'data>>
fn provide_keywords( self, kws: Value<'value, 'data>, ) -> JlrsResult<WithKeywords<'value, 'data>>
Provide keyword arguments to the function. The keyword arguments must be a
NamedTuple
. Read moreimpl<'scope, 'data> AbstractType for Function<'scope, 'data>
impl<'scope, 'data> Copy for Function<'scope, 'data>
Auto Trait Implementations§
impl<'scope, 'data> Freeze for Function<'scope, 'data>
impl<'scope, 'data> RefUnwindSafe for Function<'scope, 'data>
impl<'scope, 'data> !Send for Function<'scope, 'data>
impl<'scope, 'data> !Sync for Function<'scope, 'data>
impl<'scope, 'data> Unpin for Function<'scope, 'data>
impl<'scope, 'data> UnwindSafe for Function<'scope, 'data>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<'scope, 'data, W> Managed<'scope, 'data> for Wwhere
W: ManagedPriv<'scope, 'data>,
impl<'scope, 'data, W> Managed<'scope, 'data> for Wwhere
W: ManagedPriv<'scope, 'data>,
Source§type InScope<'target> = <W as ManagedPriv<'scope, 'data>>::WithLifetimes<'target, 'data>
type InScope<'target> = <W as ManagedPriv<'scope, 'data>>::WithLifetimes<'target, 'data>
Self
, but with an arbitrary 'target
lifetime instead of 'scope
.Source§type WithData<'da> = <W as ManagedPriv<'scope, 'data>>::WithLifetimes<'scope, 'da>
type WithData<'da> = <W as ManagedPriv<'scope, 'data>>::WithLifetimes<'scope, 'da>
Self
, but with an arbitrary 'da
lifetime instead of 'data
.Source§fn root<'target, Tgt>(
self,
target: Tgt,
) -> Tgt::Data<'data, Self::InScope<'target>>where
Tgt: Target<'target>,
fn root<'target, Tgt>(
self,
target: Tgt,
) -> Tgt::Data<'data, Self::InScope<'target>>where
Tgt: Target<'target>,
Use the target to reroot
self
.Source§fn unrooted_target(self) -> Unrooted<'scope>
fn unrooted_target(self) -> Unrooted<'scope>
Returns a new
Unrooted
.Source§fn display_string(self) -> JlrsResult<String>
fn display_string(self) -> JlrsResult<String>
Convert
self
to its display string, i.e. the string that is shown when calling
Base.show
.Source§fn error_string(self) -> JlrsResult<String>
fn error_string(self) -> JlrsResult<String>
Convert
self
to its error string, i.e. the string that is shown when calling
Base.showerror
. This string can contain ANSI color codes if this is enabled by calling
Julia::error_color
or AsyncHandle::error_color
.Source§fn display_string_or<S: Into<String>>(self, default: S) -> String
fn display_string_or<S: Into<String>>(self, default: S) -> String
Convert
self
to its display string, i.e. the string that is shown by calling
Base.display
, or some default value.