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
// SPDX-FileCopyrightText: The im-pathtree authors
// SPDX-License-Identifier: MPL-2.0

use crate::{NodeId, PathTreeTypes};

/// Half-edge to another node in the tree.
///
/// Owns the path segment.
#[derive(Debug, Clone)]
pub struct HalfEdge<T: PathTreeTypes> {
    /// The id of the target node.
    pub node_id: NodeId,

    /// Path segment from the (implicit) source to the target node.
    pub path_segment: <T as PathTreeTypes>::PathSegment,
}

/// Half-edge to another node in the tree.
///
/// Borrows the path segment.
#[derive(Debug, Clone)]
pub struct HalfEdgeRef<'a, T: PathTreeTypes> {
    /// The id of the target node.
    pub node_id: NodeId,

    /// Path segment from the (implicit) source to the target node.
    pub path_segment: &'a T::PathSegmentRef,
}