Trait Project

Source
pub trait Project<'reference, Weight>
where Weight: Element, Self: Sized,
{ // Required method fn project(weight: &'reference Weight) -> Option<Self>; }
Expand description

Enables projecting a graph element weight to a specific type.

This trait provides a mechanism to safely convert a generic graph element (vertex or edge) to a specific, strongly-typed representation.

§Type Parameters

  • 'reference: The lifetime of the reference to the weight
  • Weight: The type of the element weight being projected

Required Methods§

Source

fn project(weight: &'reference Weight) -> Option<Self>

Attempts to convert a weight to this specific type.

§Parameters
  • weight: The element weight to project
§Returns

Some(Self) if the weight can be projected to this type, None otherwise.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§