Skip to main content

object_rainbow/
object_marker.rs

1use crate::*;
2
3#[derive(ToOutput, InlineOutput, ListHashes, Topological, Parse, ParseInline)]
4pub struct ObjectMarker<T: ?Sized> {
5    object: PhantomData<fn() -> T>,
6}
7
8impl<T: ?Sized> Clone for ObjectMarker<T> {
9    fn clone(&self) -> Self {
10        *self
11    }
12}
13
14impl<T: ?Sized> Copy for ObjectMarker<T> {}
15
16impl<T: ?Sized> Default for ObjectMarker<T> {
17    fn default() -> Self {
18        Self::new()
19    }
20}
21
22impl<T: ?Sized> ObjectMarker<T> {
23    pub const fn new() -> Self {
24        Self {
25            object: PhantomData,
26        }
27    }
28}
29
30impl<T: ?Sized + Tagged> Tagged for ObjectMarker<T> {
31    const TAGS: Tags = T::TAGS;
32    const HASH: Hash = T::HASH;
33}