pub struct HostCall<'call, Profile, Provider, Return>{ /* private fields */ }Implementations§
Source§impl<'call, Profile, Provider, Return> HostCall<'call, Profile, Provider, Return>
impl<'call, Profile, Provider, Return> HostCall<'call, Profile, Provider, Return>
pub fn state(&mut self) -> &mut Provider::State
pub fn return_value( self, value: Return::Value<'call>, ) -> HostCallCompletion<'call, Return>
pub fn equal<Type: HostType>( &self, left: Type::Value<'call>, right: Type::Value<'call>, ) -> bool
Sourcepub fn source_hash<Type: HostType>(&self, value: Type::Value<'call>) -> u64
pub fn source_hash<Type: HostType>(&self, value: Type::Value<'call>) -> u64
Hashes a call-scoped value consistently with Gleam source equality.
The result is intended for runtime lookup within this execution. It is not a stable serialization or a process-independent value.
Sourcepub fn inspect<Type: HostType>(&self, value: Type::Value<'call>) -> EcoString
pub fn inspect<Type: HostType>(&self, value: Type::Value<'call>) -> EcoString
Returns the canonical Gleam-facing inspection of a call-scoped value.
pub fn list_len<Item>(&self, value: HostList<'call, Item>) -> usize
pub fn list_item<Item: HostType>( &mut self, value: HostList<'call, Item>, index: usize, ) -> Option<Item::Value<'call>>
Sourcepub fn construct_list<Item: HostType>(
&mut self,
_construction: HostConstruction<'call, HostListType<Item>>,
values: impl IntoIterator<Item = Item::Value<'call>>,
) -> HostList<'call, Item>
pub fn construct_list<Item: HostType>( &mut self, _construction: HostConstruction<'call, HostListType<Item>>, values: impl IntoIterator<Item = Item::Value<'call>>, ) -> HostList<'call, Item>
Constructs a list authorized by one registered construction token.
pub fn tuple_len<Elements>(&self, value: HostTuple<'call, Elements>) -> usize
pub fn tuple_values<Elements: HostTypeSequence>( &mut self, value: HostTuple<'call, Elements>, ) -> Elements::Values<'call>
Sourcepub fn construct_tuple<Elements: HostTypeSequence>(
&mut self,
_construction: HostConstruction<'call, HostTupleType<Elements>>,
values: Elements::Values<'call>,
) -> HostTuple<'call, Elements>
pub fn construct_tuple<Elements: HostTypeSequence>( &mut self, _construction: HostConstruction<'call, HostTupleType<Elements>>, values: Elements::Values<'call>, ) -> HostTuple<'call, Elements>
Constructs a tuple authorized by one registered construction token.
pub fn custom_constructor<Custom>( &self, value: HostCustom<'call, Custom>, ) -> usize
pub fn custom_fields<Constructor>(
&mut self,
value: HostCustom<'call, Constructor::Custom>,
) -> Option<<Constructor::Fields as HostTypeSequence>::Values<'call>>where
Constructor: HostCustomConstructor,
Sourcepub fn construct_custom<Constructor>(
&mut self,
_construction: HostConstruction<'call, Constructor::Custom>,
fields: <Constructor::Fields as HostTypeSequence>::Values<'call>,
) -> HostCustom<'call, Constructor::Custom>
pub fn construct_custom<Constructor>( &mut self, _construction: HostConstruction<'call, Constructor::Custom>, fields: <Constructor::Fields as HostTypeSequence>::Values<'call>, ) -> HostCustom<'call, Constructor::Custom>
Constructs an ordinary custom value authorized by one registered type token.
Sourcepub fn external_payload<Schema, Arguments>(
&self,
value: HostExternal<'call, HostExternalType<Schema, Arguments>>,
) -> HostExternalPayloadView<'call, <<Provider as HostExternalBinding<Profile, Schema>>::Storage as HostExternalStorage<Profile, Schema>>::Payload, Arguments>where
Schema: HostExternalSchema,
Provider: HostExternalBinding<Profile, Schema>,
Arguments: HostTypeSequence,
pub fn external_payload<Schema, Arguments>(
&self,
value: HostExternal<'call, HostExternalType<Schema, Arguments>>,
) -> HostExternalPayloadView<'call, <<Provider as HostExternalBinding<Profile, Schema>>::Storage as HostExternalStorage<Profile, Schema>>::Payload, Arguments>where
Schema: HostExternalSchema,
Provider: HostExternalBinding<Profile, Schema>,
Arguments: HostTypeSequence,
Borrows the Rust payload behind one typed external value.
Sourcepub fn invoke<Arguments, FunctionReturn>(
&mut self,
function: HostCallable<'call, Arguments, FunctionReturn>,
arguments: Arguments::Values<'call>,
) -> Result<FunctionReturn::Value<'call>, HostCallError>where
Arguments: HostTypeSequence,
FunctionReturn: HostType,
pub fn invoke<Arguments, FunctionReturn>(
&mut self,
function: HostCallable<'call, Arguments, FunctionReturn>,
arguments: Arguments::Values<'call>,
) -> Result<FunctionReturn::Value<'call>, HostCallError>where
Arguments: HostTypeSequence,
FunctionReturn: HostType,
Invokes a Gleam callable while this host call owns the active runtime.
A provider-state borrow must end before re-entry.
use geam_core::{
HostCall, HostCallCompletion, HostCallError, HostCallable, HostProfile, HostProvider,
HostTypeList, HostTypeListEnd,
};
use num_bigint::BigInt;
struct Profile;
struct Provider;
impl HostProfile for Profile {
type RunState = usize;
type ExternalStores = ();
}
impl HostProvider<Profile> for Provider {
type State = usize;
fn project(state: &mut usize) -> &mut Self::State {
state
}
}
type Arguments = HostTypeList<BigInt, HostTypeListEnd>;
fn reenter_with_live_state<'call>(
mut call: HostCall<'call, Profile, Provider, BigInt>,
callable: HostCallable<'call, Arguments, BigInt>,
) -> Result<HostCallCompletion<'call, BigInt>, HostCallError> {
let state = call.state();
let returned = call.invoke(callable, (BigInt::from(1), ()))?;
*state += 1;
Ok(call.return_value(returned))
}Sourcepub fn construct_external_with<Schema, Arguments>(
&mut self,
_construction: HostConstruction<'call, HostExternalType<Schema, Arguments>>,
build: impl FnOnce(&mut HostExternalPayloadBuilder<'_, Profile, Arguments>) -> <<Provider as HostExternalBinding<Profile, Schema>>::Storage as HostExternalStorage<Profile, Schema>>::Payload,
) -> HostExternal<'call, HostExternalType<Schema, Arguments>>where
Schema: HostExternalSchema,
Provider: HostExternalBinding<Profile, Schema>,
Arguments: HostTypeSequence,
HostExternalType<Schema, Arguments>: HostType,
pub fn construct_external_with<Schema, Arguments>(
&mut self,
_construction: HostConstruction<'call, HostExternalType<Schema, Arguments>>,
build: impl FnOnce(&mut HostExternalPayloadBuilder<'_, Profile, Arguments>) -> <<Provider as HostExternalBinding<Profile, Schema>>::Storage as HostExternalStorage<Profile, Schema>>::Payload,
) -> HostExternal<'call, HostExternalType<Schema, Arguments>>where
Schema: HostExternalSchema,
Provider: HostExternalBinding<Profile, Schema>,
Arguments: HostTypeSequence,
HostExternalType<Schema, Arguments>: HostType,
Constructs an intermediate external payload that retains typed Gleam values.
Source§impl<'call, Profile, Provider, Schema, Arguments> HostCall<'call, Profile, Provider, HostExternalType<Schema, Arguments>>where
Profile: HostProfile,
Provider: HostProvider<Profile>,
Schema: HostExternalSchema,
Arguments: HostTypeSequence,
HostExternalType<Schema, Arguments>: HostType,
impl<'call, Profile, Provider, Schema, Arguments> HostCall<'call, Profile, Provider, HostExternalType<Schema, Arguments>>where
Profile: HostProfile,
Provider: HostProvider<Profile>,
Schema: HostExternalSchema,
Arguments: HostTypeSequence,
HostExternalType<Schema, Arguments>: HostType,
pub fn create_external(
&mut self,
value: <<Provider as HostExternalBinding<Profile, Schema>>::Storage as HostExternalStorage<Profile, Schema>>::Payload,
) -> HostExternal<'call, HostExternalType<Schema, Arguments>>where
Provider: HostExternalBinding<Profile, Schema>,
Sourcepub fn create_external_with(
&mut self,
build: impl FnOnce(&mut HostExternalPayloadBuilder<'_, Profile, Arguments>) -> <<Provider as HostExternalBinding<Profile, Schema>>::Storage as HostExternalStorage<Profile, Schema>>::Payload,
) -> HostExternal<'call, HostExternalType<Schema, Arguments>>where
Provider: HostExternalBinding<Profile, Schema>,
pub fn create_external_with(
&mut self,
build: impl FnOnce(&mut HostExternalPayloadBuilder<'_, Profile, Arguments>) -> <<Provider as HostExternalBinding<Profile, Schema>>::Storage as HostExternalStorage<Profile, Schema>>::Payload,
) -> HostExternal<'call, HostExternalType<Schema, Arguments>>where
Provider: HostExternalBinding<Profile, Schema>,
Creates an external payload that may retain typed Gleam values.
Source§impl<'call, Profile, Provider, Return> HostCall<'call, Profile, Provider, Return>
impl<'call, Profile, Provider, Return> HostCall<'call, Profile, Provider, Return>
Sourcepub fn construct_external<Schema, Arguments>(
&mut self,
_construction: HostConstruction<'call, HostExternalType<Schema, Arguments>>,
value: <<Provider as HostExternalBinding<Profile, Schema>>::Storage as HostExternalStorage<Profile, Schema>>::Payload,
) -> HostExternal<'call, HostExternalType<Schema, Arguments>>where
Schema: HostExternalSchema,
Provider: HostExternalBinding<Profile, Schema>,
Arguments: HostTypeSequence,
HostExternalType<Schema, Arguments>: HostType,
pub fn construct_external<Schema, Arguments>(
&mut self,
_construction: HostConstruction<'call, HostExternalType<Schema, Arguments>>,
value: <<Provider as HostExternalBinding<Profile, Schema>>::Storage as HostExternalStorage<Profile, Schema>>::Payload,
) -> HostExternal<'call, HostExternalType<Schema, Arguments>>where
Schema: HostExternalSchema,
Provider: HostExternalBinding<Profile, Schema>,
Arguments: HostTypeSequence,
HostExternalType<Schema, Arguments>: HostType,
Constructs an intermediate external payload authorized by one registered type token.
Source§impl<'call, Profile, Provider, Item> HostCall<'call, Profile, Provider, HostListType<Item>>
impl<'call, Profile, Provider, Item> HostCall<'call, Profile, Provider, HostListType<Item>>
pub fn return_list( self, values: impl IntoIterator<Item = Item::Value<'call>>, ) -> HostCallCompletion<'call, HostListType<Item>>
Source§impl<'call, Profile, Provider, Elements> HostCall<'call, Profile, Provider, HostTupleType<Elements>>
impl<'call, Profile, Provider, Elements> HostCall<'call, Profile, Provider, HostTupleType<Elements>>
pub fn return_tuple( self, values: <Elements as HostTypeSequence>::Values<'call>, ) -> HostCallCompletion<'call, HostTupleType<Elements>>
Source§impl<'call, Profile, Provider, Schema, Arguments> HostCall<'call, Profile, Provider, HostCustomType<Schema, Arguments>>where
Profile: HostProfile,
Provider: HostProvider<Profile>,
Schema: HostCustomSchema,
Arguments: HostTypeSequence,
impl<'call, Profile, Provider, Schema, Arguments> HostCall<'call, Profile, Provider, HostCustomType<Schema, Arguments>>where
Profile: HostProfile,
Provider: HostProvider<Profile>,
Schema: HostCustomSchema,
Arguments: HostTypeSequence,
pub fn return_custom<Constructor>(
self,
fields: <Constructor::Fields as HostTypeSequence>::Values<'call>,
) -> HostCallCompletion<'call, HostCustomType<Schema, Arguments>>where
Constructor: HostCustomConstructor<Custom = HostCustomType<Schema, Arguments>>,
Constructor::Fields: HostTypeSequence,
Auto Trait Implementations§
impl<'call, Profile, Provider, Return> !RefUnwindSafe for HostCall<'call, Profile, Provider, Return>
impl<'call, Profile, Provider, Return> !Send for HostCall<'call, Profile, Provider, Return>
impl<'call, Profile, Provider, Return> !Sync for HostCall<'call, Profile, Provider, Return>
impl<'call, Profile, Provider, Return> !UnwindSafe for HostCall<'call, Profile, Provider, Return>
impl<'call, Profile, Provider, Return> Freeze for HostCall<'call, Profile, Provider, Return>
impl<'call, Profile, Provider, Return> Unpin for HostCall<'call, Profile, Provider, Return>
impl<'call, Profile, Provider, Return> UnsafeUnpin for HostCall<'call, Profile, Provider, Return>where
&'call mut dyn HostCallRuntime<Profile>: UnsafeUnpin,
PhantomData<(Provider, Return)>: UnsafeUnpin,
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.