geam 0.1.1

Experimental Rust-embedded execution runtime for typed Gleam programs
use crate::host::{
    HostFunctionImplementation as RegisteredHostFunctionImplementation, HostProfile,
};
use crate::plan::FunctionTemplateId;
use std::sync::Arc;

pub(crate) struct HostImplementationBinding<Profile: HostProfile> {
    template: FunctionTemplateId,
    constructions: crate::host::RegisteredHostConstructions,
    implementation: Arc<RegisteredHostFunctionImplementation<Profile>>,
}

impl<Profile: HostProfile> HostImplementationBinding<Profile> {
    pub(crate) fn new(
        template: FunctionTemplateId,
        constructions: crate::host::RegisteredHostConstructions,
        implementation: Arc<RegisteredHostFunctionImplementation<Profile>>,
    ) -> Self {
        Self {
            template,
            constructions,
            implementation,
        }
    }

    pub(crate) fn into_parts(
        self,
    ) -> (
        FunctionTemplateId,
        crate::host::RegisteredHostConstructions,
        Arc<RegisteredHostFunctionImplementation<Profile>>,
    ) {
        (self.template, self.constructions, self.implementation)
    }
}