use std::marker::PhantomData;
use crate::Handle;
use super::{PropMap, Value};
#[derive(Clone, Copy, Debug)]
pub struct ConstMap<T>(pub T);
impl<T, H: Handle> PropMap<H> for ConstMap<T> {
type Target = T;
type Ret<'s> = &'s Self::Target where Self::Target: 's;
fn get(&self, _: H) -> Option<Value<Self::Ret<'_>, Self::Target>> {
Some((&self.0).into())
}
}
#[derive(Clone, Copy, Debug)]
pub struct EmptyMap<T>(PhantomData<T>);
impl<T> EmptyMap<T> {
pub fn new() -> Self {
EmptyMap(PhantomData)
}
}
impl<T, H: Handle> PropMap<H> for EmptyMap<T> {
type Target = T;
type Ret<'s> = Self::Target where T: 's;
fn get(&self, _: H) -> Option<Value<Self::Ret<'_>, Self::Target>> {
None
}
}