pub trait Label {
    type Label: Display + Clone;

    fn label(&self) -> Self::Label;
}
Expand description

Label for a node. The label type must be very cheap to clone and move around. for strings, Arc or Rc is preferred when implementing this type.

use meshed::prelude::*;
use std::rc::Rc;

#[derive(Clone)]
struct Identifier(Rc<str>);

impl std::fmt::Display for Identifier {
  fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
        todo!()
  }
}

struct Data {
    id: Identifier
}

impl Label for Data {
    type Label = Identifier;
    fn label(&self) -> Self::Label {
       self.id.clone()
    }
}

Required Associated Types

Required Methods

Implementors