borrow_bag/handle.rs
1use std::marker::PhantomData;
2
3/// Navigator type describing a skipped element
4pub struct Skip;
5
6/// Navigator type describing the target element
7pub struct Take;
8
9/// A value which can be used with the `BorrowBag` to borrow the element which was added.
10///
11/// See [`BorrowBag`][BorrowBag] for usage examples.
12///
13/// [BorrowBag]: struct.BorrowBag.html
14pub struct Handle<T, N> {
15 phantom: PhantomData<(T, N)>,
16}
17
18/// Creates a new `Handle` of any given type.
19pub(crate) fn new_handle<T, N>() -> Handle<T, N> {
20 Handle {
21 phantom: PhantomData,
22 }
23}
24
25impl<T, N> Clone for Handle<T, N> {
26 fn clone(&self) -> Handle<T, N> {
27 *self
28 }
29}
30
31// Derived `Copy` doesn't work here.
32impl<T, N> Copy for Handle<T, N> {}