pub trait RailwayApiClient {
    // Required methods
    fn connect<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        url: &'life1 str
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn fetch_by_area_name<'life0, 'life1, 'async_trait>(
        &'life0 self,
        area_name: &'life1 str
    ) -> Pin<Box<dyn Future<Output = Result<Value>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn fetch_by_bbox<'life0, 'life1, 'async_trait>(
        &'life0 self,
        bbox: &'life1 str
    ) -> Pin<Box<dyn Future<Output = Result<Value>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

A trait for implementing an Railway API client.

RailwayApiClient is an asynchronous trait that provides a common interface for fetching data by area name or bounding box.

Required Methods§

source

fn connect<'life0, 'life1, 'async_trait>( &'life0 mut self, url: &'life1 str ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Connect to the OpenRailwayMap API using the specified URL.

Arguments
  • url - The URL of the OpenRailwayMap API.
Returns

A Result indicating success or failure.

source

fn fetch_by_area_name<'life0, 'life1, 'async_trait>( &'life0 self, area_name: &'life1 str ) -> Pin<Box<dyn Future<Output = Result<Value>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Fetch OpenRailwayMap data by area name.

Arguments
  • area_name - The name of the area for which to fetch data.
Returns

A Result containing a JSON Value with the fetched data on success, or an error on failure.

source

fn fetch_by_bbox<'life0, 'life1, 'async_trait>( &'life0 self, bbox: &'life1 str ) -> Pin<Box<dyn Future<Output = Result<Value>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Fetch OpenRailwayMap data by bounding box.

Arguments
  • bbox - A string representing the bounding box for which to fetch data.
Returns

A Result containing a JSON Value with the fetched data on success, or an error on failure.

Implementors§