use std::fmt::Debug;
use allocative::Allocative;
use starlark_derive::starlark_value;
use starlark_derive::NoSerialize;
use crate as starlark;
use crate::any::ProvidesStaticType;
use crate::eval::runtime::profile::instant::ProfilerInstant;
use crate::values::StarlarkValue;
use crate::values::Trace;
use crate::values::Value;
pub(crate) trait MaybeDrop: Debug + Sync + Send + Allocative + 'static {}
#[derive(ProvidesStaticType, Debug, Trace, Allocative)]
pub(crate) struct NeedsDrop;
impl Drop for NeedsDrop {
fn drop(&mut self) {
}
}
#[derive(ProvidesStaticType, Debug, Trace, Allocative)]
pub(crate) struct NoDrop;
impl MaybeDrop for NeedsDrop {}
impl MaybeDrop for NoDrop {}
#[derive(
Trace,
Debug,
derive_more::Display,
ProvidesStaticType,
NoSerialize,
Allocative
)]
#[display("CallEnter")]
pub(crate) struct CallEnter<'v, D: MaybeDrop + 'static> {
pub(crate) function: Value<'v>,
pub(crate) time: ProfilerInstant,
pub(crate) maybe_drop: D,
}
#[starlark_value(type = "call_enter")]
impl<'v, D: MaybeDrop + Trace<'v> + 'v> StarlarkValue<'v> for CallEnter<'v, D> {
type Canonical = Self;
}
#[derive(
Debug,
derive_more::Display,
ProvidesStaticType,
NoSerialize,
Allocative
)]
#[display("CallExit")]
pub(crate) struct CallExit<D: MaybeDrop + 'static> {
pub(crate) time: ProfilerInstant,
pub(crate) maybe_drop: D,
}
#[starlark_value(type = "call_exit")]
impl<'v, D: MaybeDrop> StarlarkValue<'v> for CallExit<D> {
type Canonical = Self;
}