Skip to content

Commit

Permalink
Fix PlayerEvents not being reachable from root
Browse files Browse the repository at this point in the history
Added unreachable_pub lint which should help to prevent this issue from
happening again.

Note: due to a compiler error, the root-level `metadata` re-exports had
to be split into 3; see
rust-lang/rust#64762
  • Loading branch information
ischeinkman authored and Mange committed Feb 15, 2020
1 parent 75245d2 commit a19ae05
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ pub struct PlayerEvents<'a> {
}

impl<'a> PlayerEvents<'a> {
pub fn new(player: &'a Player<'a>) -> Result<PlayerEvents<'a>, DBusError> {
pub(crate) fn new(player: &'a Player<'a>) -> Result<PlayerEvents<'a>, DBusError> {
let progress = Progress::from_player(player)?;
Ok(PlayerEvents {
player,
Expand All @@ -123,6 +123,7 @@ impl<'a> PlayerEvents<'a> {
})
}

/// Current tracklist of the player. Will be kept up to date.
pub fn track_list(&self) -> Option<&TrackList> {
self.track_list.as_ref()
}
Expand Down
9 changes: 7 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
trivial_casts,
trivial_numeric_casts,
unsafe_code,
unreachable_pub,
unstable_features,
unused_import_braces,
unused_qualifications
Expand Down Expand Up @@ -50,6 +51,8 @@ extern crate from_variants;
extern crate dbus;

mod extensions;

#[allow(unreachable_pub)]
mod generated;

mod event;
Expand All @@ -60,9 +63,11 @@ mod pooled_connection;
mod progress;
mod track_list;

pub use crate::event::{Event, EventError};
pub use crate::event::{Event, EventError, PlayerEvents};
pub use crate::find::{FindingError, PlayerFinder};
pub use crate::metadata::{Metadata, Value as MetadataValue, ValueKind as MetadataValueKind};
pub use crate::metadata::Metadata;
pub use crate::metadata::ValueKind as MetadataValueKind;
pub use crate::metadata::Value as MetadataValue;
pub use crate::player::Player;
pub use crate::progress::{Progress, ProgressError, ProgressTick, ProgressTracker};
pub use crate::track_list::{TrackID, TrackList, TrackListError};
Expand Down
2 changes: 1 addition & 1 deletion src/player.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ pub(crate) const MPRIS2_PREFIX: &str = "org.mpris.MediaPlayer2.";
pub(crate) const MPRIS2_PATH: &str = "/org/mpris/MediaPlayer2";

/// When D-Bus connection is managed for you, use this timeout while communicating with a Player.
pub const DEFAULT_TIMEOUT_MS: i32 = 500; // ms
pub(crate) const DEFAULT_TIMEOUT_MS: i32 = 500; // ms

/// A MPRIS-compatible player.
///
Expand Down

0 comments on commit a19ae05

Please sign in to comment.