use crate::guest::alloc::{Allocator, Collect, Collector, CommitPassthrough};
use crate::Result;
use super::{kind, Call};
pub trait Stub {
type Ret;
fn collect(self, _: &impl Collector) -> Self::Ret;
}
impl<T: Stub> Call<'_, kind::Stub> for T {
type Staged = Self;
type Committed = Self;
type Collected = T::Ret;
fn stage(self, _: &mut impl Allocator) -> Result<Self::Staged> {
Ok(self)
}
}
impl<T: Stub> CommitPassthrough for T {}
impl<T: Stub> Collect for T {
type Item = T::Ret;
fn collect(self, col: &impl Collector) -> Self::Item {
self.collect(col)
}
}