Crate yxhoo_transit

Crate yxhoo_transit 

Source
Expand description

§yxhoo-transit

A Rust client for the unofficial Yxhoo! Transit (Japan) API.

§Feature flags

Exactly one HTTP client feature must be enabled.

  • http-reqwest (default)
  • http-wreq
  • schemars: Enable JsonSchema derives for public types.
# default (reqwest)
cargo test

# wreq
cargo test --no-default-features --features http-wreq,schemars

§Example

use yxhoo_transit::{suggest_places, transit, args::{TransitArgs, DateKind}};

let suggestions = suggest_places("新宿").await?;
println!("{:?}", suggestions);

let args = TransitArgs {
    from: "新宿".into(),
    to: "渋谷".into(),
    date: chrono::Local::now().into(),
    date_kind: DateKind::DepartureTime,
    rank: 1,
    ..Default::default()
};
let result = transit(&args).await?;
println!("{:?}", result);

§Notes

This crate uses an unofficial API and may break without notice.

Modules§

args
transit_dto

Structs§

YxhooPlace
Suggested place entry.
YxhooSuggestResponse
Suggest API response payload.

Enums§

YxhooPlaceKind
Kind of suggested place returned by Yxhoo.

Functions§

suggest_places
Suggest places by a free-form query string.
transit
Search transit routes using the given arguments.