Coder Social home page Coder Social logo

bobertoyin / mbta-rs Goto Github PK

View Code? Open in Web Editor NEW
4.0 1.0 0.0 86 KB

A Rust client to interact with the MBTA V3 API.

Home Page: https://crates.io/crates/mbta-rs

License: MIT License

Rust 100.00%
mbta public-transportation massachusetts client-library

mbta-rs's Issues

Change `Plottable` trait's `plot` method to use `&self` instead of `self`

Is your feature request related to a problem? Please describe.
There's not much of a reason to consume the plottable data when only references to the data fields are necessary.

Describe the solution you'd like
Change function signature from fn plot(self... to fn plot(&self...

Describe alternatives you've considered
N/A

Additional context
N/A

Consider making `Client` `Send + Sync`

Is your feature request related to a problem? Please describe.
The Client struct doesn't mutate itself, so it should be handy enough to add these traits to the client in order to make it work better with multi-threaded use-cases.

Describe the solution you'd like
Derive/implement the above traits for the struct.

Describe alternatives you've considered
N/A

Additional context
N/A

Loosen type for query parameters

Is your feature request related to a problem? Please describe.
Query parameters for endpoints are currently expected to be of HashMap<String, String>: this type is generally too inconvenient and restrictive and could be loosened to be easier to use.

Describe the solution you'd like
Internally, each endpoint function iterates over each key-value pair and only uses the &str values: this means that we could have some generic parameter that implements IntoIterator<Item = (AsRef<Str>, AsRef<Str>)> (this is obviously not what it'll look like in Rust, but it captures the essence of what the generic should look like).

Describe alternatives you've considered
N/A

Additional context
N/A

Optional feature: tile-map rendering of location data

Is your feature request related to a problem? Please describe.
The MBTA V3 API contains a lot of latitudinal and longitudinal data: it'd be cool to provide some simple, optional functionality to plot this data!

Describe the solution you'd like
Leveraging the staticmap crate seems to be the simplest solution: it's a no-frills library that can render the simplest elements necessary (lines, circles, icons) without being too hefty of an addition.

Describe alternatives you've considered
There are plenty of crates related to OpenStreetMap and Google Maps, but none of them are quite as "batteries-included" a.k.a "no-implementation-required" as staticmap.

Better Request Error Results

Is your feature request related to a problem? Please describe.
Currently, invalid request errors are boxed into a high-level client error; this isn't particularly helpful in diagnosing what specific issues the MBTA API had with the request (typically invalid query parameters or non-existent resources).

Describe the solution you'd like
ureq errors have a Status error that contains a status code and a response object with a known schema. This means that a helpful "error" response could be returned that indicates to the user what issues the API had with the request. Refactoring would convert the existing Response struct into an enum with some kind of Success variant and Error variant, with the Success variant containing the current Response schema and the Error variant containing the error response schema.

Describe alternatives you've considered
N/A

Additional context
N/A

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.