Crate graphex

Source
Expand description

Graphex (Grah Explorer) is a small library helper to build command line tool to explore (pseudo) graph.

It mainly defines two traits (Node and Display) user have to implement for its structs.

  • Node is for traversing the graph from node to node.
  • Display is for display the final node at end of exploration.

Few other strucs and functions are defined as helper.

§Features

“Serde” support can be added using serde feature. It add the Node::serde method to get a serde value from a Node.

To avoid any compilation error when a third party project activate the serde feature on a project which has not implemented Node::serde, Node::serde returns a Option and a default implementation returning None is provided.

However, providing a default implementation prevent the compiler to fail if someone forget to implement Node::serde. The feature serde_no_defaul_impl do not provide a default implementation and so compiler fails if Node::serde is not implemented.

!! serde_no_default_impl MUST NOT be activated in Cargo.toml. Activate it only temporarly from command line cargo build --features=serde_no_default_impl !

Structs§

AsBytes
A wrapper structure on a &[u8] to display it as a bytes value instead of array of u8.
Output
A output where to write the value.

Enums§

Error
Error type of graphex.
NodeObject
A actual Node

Traits§

Display
Display the value to the user.
Node
The trait each node must implement.

Functions§

display
Display the node to whatever implement std::fmt::Write.
display_to_string
Display the node to a String and return it.
explore
Explore a node following the key.
explore_to_string
Explore a node following the key and display it in a string using display_to_string

Type Aliases§

ExploreResult
Result
Result type of graphex.