1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
use std::marker::PhantomData;

/// Navigator type describing a skipped element
pub struct Skip;

/// Navigator type describing the target element
pub struct Take;

/// A value which can be used with the `BorrowBag` to borrow the element which was added.
///
/// See [`BorrowBag`][BorrowBag] for usage examples.
///
/// [BorrowBag]: struct.BorrowBag.html
pub struct Handle<T, N> {
    phantom: PhantomData<(T, N)>,
}

/// Creates a new `Handle` of any given type.
pub(crate) fn new_handle<T, N>() -> Handle<T, N> {
    Handle {
        phantom: PhantomData,
    }
}

impl<T, N> Clone for Handle<T, N> {
    fn clone(&self) -> Handle<T, N> {
        *self
    }
}

// Derived `Copy` doesn't work here.
impl<T, N> Copy for Handle<T, N> {}