pub trait RailwayGraphImporter {
// Required method
fn import(input: &Value) -> Result<RailwayGraph>;
}
Expand description
RailwayGraphImporter
is a trait for importing railway graph data from different formats/sources.
It provides a single method, import
, which takes a reference to a serde_json::Value
and returns
a Result<RailwayGraph>
. Implementations of this trait are responsible for converting the input data
into a RailwayGraph
object.
Required Methods§
sourcefn import(input: &Value) -> Result<RailwayGraph>
fn import(input: &Value) -> Result<RailwayGraph>
Imports a railway graph from a given input data.
This method receives a reference to a serde_json::Value
and should return a Result<RailwayGraph>
after processing the input data. In case of errors, an appropriate error type should be returned.
Arguments
input
- A reference to aserde_json::Value
representing the input data.
Returns
A Result<RailwayGraph>
containing the imported railway graph, or an error if the import fails.