pub struct GtfsClient { /* private fields */ }Expand description
Client for GTFS (General Transit Feed Specification) via Transitland API
Provides access to public transit data including:
- Transit stops and stations
- Routes and schedules
- Real-time departures
- Transit agencies/operators
§Example
ⓘ
use ruvector_data_framework::GtfsClient;
let client = GtfsClient::new();
let stops = client.search_stops("San Francisco").await?;
let routes = client.get_routes("o-9q9-bart").await?;
let departures = client.get_departures("s-9q8y-16thandmission").await?;Implementations§
Source§impl GtfsClient
impl GtfsClient
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new GTFS client using Transitland API v2
§Arguments
api_key- Optional Transitland API key for higher rate limits Free tier: 60 requests/minute
Sourcepub fn with_api_key(api_key: Option<String>) -> Self
pub fn with_api_key(api_key: Option<String>) -> Self
Create a new GTFS client with API key
Sourcepub async fn search_stops(&self, query: &str) -> Result<Vec<SemanticVector>>
pub async fn search_stops(&self, query: &str) -> Result<Vec<SemanticVector>>
Sourcepub async fn get_routes(&self, operator_id: &str) -> Result<Vec<SemanticVector>>
pub async fn get_routes(&self, operator_id: &str) -> Result<Vec<SemanticVector>>
Sourcepub async fn get_departures(&self, stop_id: &str) -> Result<Vec<SemanticVector>>
pub async fn get_departures(&self, stop_id: &str) -> Result<Vec<SemanticVector>>
Sourcepub async fn search_agencies(&self, query: &str) -> Result<Vec<SemanticVector>>
pub async fn search_agencies(&self, query: &str) -> Result<Vec<SemanticVector>>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for GtfsClient
impl !RefUnwindSafe for GtfsClient
impl Send for GtfsClient
impl Sync for GtfsClient
impl Unpin for GtfsClient
impl !UnwindSafe for GtfsClient
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more