fj_core/operations/insert/
is_inserted.rs

1use std::borrow::Borrow;
2
3use crate::storage::Handle;
4
5/// Indicate whether an object has been inserted
6///
7/// Intended to be used as a type parameter bound for structs that need to track
8/// whether their contents have been inserted or not.
9pub trait IsInserted {
10    /// The type of the object for which the insertion status is tracked
11    type T<T>: Borrow<T>;
12}
13
14/// Indicate that an object has been inserted
15///
16/// See [`IsInserted`].
17pub struct IsInsertedYes;
18
19impl IsInserted for IsInsertedYes {
20    type T<T> = Handle<T>;
21}
22
23/// Indicate that an object has not been inserted
24///
25/// See [`IsInserted`].
26pub struct IsInsertedNo;
27
28impl IsInserted for IsInsertedNo {
29    type T<T> = T;
30}