Skip to content

Commit

Permalink
Merge pull request #12 from bobertoyin/11-change-plottable-traits-plo…
Browse files Browse the repository at this point in the history
…t-method-to-use-self-instead-of-self

feat: change data model plotting to use reference to self instead of …
  • Loading branch information
bobertoyin authored May 26, 2022
2 parents 40e98f6 + 762f0ef commit 8f8175f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "mbta-rs"
version = "0.3.0"
version = "0.4.0"
edition = "2021"
authors = ["Robert Yin <bobertoyin@gmail.com>"]
description = "Simple Rust client for interacting with the MBTA V3 API."
Expand Down
8 changes: 4 additions & 4 deletions src/map/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,11 @@ pub trait Plottable<D> {
/// * `map` - mutable reference to a tile map
/// * `anti_alias` - whether to render with anti-aliasing or not
/// * `plot_style` - plot style for the model
fn plot(self, map: &mut StaticMap, anti_alias: bool, extra_data: D) -> Result<(), PlotError>;
fn plot(&self, map: &mut StaticMap, anti_alias: bool, extra_data: D) -> Result<(), PlotError>;
}

impl Plottable<PlotStyle> for Stop {
fn plot(self, map: &mut StaticMap, anti_alias: bool, plot_style: PlotStyle) -> Result<(), PlotError> {
fn plot(&self, map: &mut StaticMap, anti_alias: bool, plot_style: PlotStyle) -> Result<(), PlotError> {
if let Some(border_data) = plot_style.border {
let border = CircleBuilder::new()
.lat_coordinate(self.attributes.latitude)
Expand All @@ -153,7 +153,7 @@ impl Plottable<PlotStyle> for Stop {
}

impl Plottable<IconStyle> for Vehicle {
fn plot(self, map: &mut StaticMap, _anti_alias: bool, icon_style: IconStyle) -> Result<(), PlotError> {
fn plot(&self, map: &mut StaticMap, _anti_alias: bool, icon_style: IconStyle) -> Result<(), PlotError> {
let icon = IconBuilder::new()
.lat_coordinate(self.attributes.latitude)
.lon_coordinate(self.attributes.longitude)
Expand All @@ -167,7 +167,7 @@ impl Plottable<IconStyle> for Vehicle {
}

impl Plottable<PlotStyle> for Shape {
fn plot(self, map: &mut StaticMap, anti_alias: bool, plot_style: PlotStyle) -> Result<(), PlotError> {
fn plot(&self, map: &mut StaticMap, anti_alias: bool, plot_style: PlotStyle) -> Result<(), PlotError> {
let points = decode_polyline(&self.attributes.polyline, 5).map_err(PlotError::PolylineError)?;
if let Some(border_data) = plot_style.border {
let border = LineBuilder::new()
Expand Down

0 comments on commit 8f8175f

Please sign in to comment.