[][src]Trait tree_edit_distance::Node

pub trait Node<'n> {
    type Kind: Eq;
    type Weight: Default + Copy + Ord + Add<Output = Self::Weight>;
    type Child: Borrow<Self>;
    type Children: Borrow<[Self::Child]>;
    fn kind(&'n self) -> Self::Kind;
fn weight(&'n self) -> Self::Weight;
fn children(&'n self) -> Self::Children; }

An abstraction for a generic tree.

Associated Types

type Kind: Eq

A type whose values encode the Node's kind.

Only Nodes of the same kind can be replaced by one another.

type Weight: Default + Copy + Ord + Add<Output = Self::Weight>

A type whose values encode this Node's weight.

The default value of this type is assumed to be the additive identity (i.e. zero).

type Child: Borrow<Self>

A type that may be borrowed as &Self.

This is often just Self or &'n Self, but need not necessarily be.

type Children: Borrow<[Self::Child]>

A type that holds this Node's children as a contiguous sequence (i.e. a slice).

Loading content...

Required methods

fn kind(&'n self) -> Self::Kind

Returns a value that encodes this Node's kind.

fn weight(&'n self) -> Self::Weight

Returns the cost of inserting or deleting this Node.

A Node's weight should be independent of the weight of its children.

fn children(&'n self) -> Self::Children

Returns this Node's children.

Loading content...

Implementors

Loading content...