geam 0.1.1

Experimental Rust-embedded execution runtime for typed Gleam programs
use super::super::schema::InspectValue;
use super::StringProvider;
use crate::gleam_stdlib::GleamStdlibHostProfile;
use crate::gleam_stdlib::string_tree::{StoredStringTree, StringTree, StringTreePayload};
use crate::{HostCall, HostCallCompletion, HostCallError, HostValue};

pub(in crate::gleam_stdlib::string) fn do_inspect<'call, Profile>(
    mut call: HostCall<'call, Profile, StringProvider<Profile>, StringTree>,
    value: HostValue<'call, InspectValue>,
) -> Result<HostCallCompletion<'call, StringTree>, HostCallError>
where
    Profile: GleamStdlibHostProfile,
{
    let inspection = call.inspect::<InspectValue>(value);
    let value = call.create_external(StringTreePayload {
        tree: StoredStringTree::text(inspection),
    });
    Ok(call.return_value(value))
}