[GH-ISSUE #64] No function new_with_name for struct MediaControls #46

Closed
opened 2026-02-28 14:30:14 +03:00 by kerem · 6 comments
Owner

Originally created by @olligobber on GitHub (Jul 4, 2021).
Original GitHub issue: https://github.com/jpochyla/psst/issues/64

When installing from the aur (https://aur.archlinux.org/packages/psst-git/) I got the following error:

   Compiling psst-gui v0.1.0 (/home/oliver/.cache/yay/psst-git/src/psst/psst-gui)
error[E0599]: no function or associated item named `new_with_name` found for struct `MediaControls` in the current scope
  --> psst-gui/src/controller/playback.rs:87:49
   |
87 |         let mut media_controls = MediaControls::new_with_name("psst", "Psst");
   |                                                 ^^^^^^^^^^^^^ function or associated item not found in `MediaControls`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0599`.
error: could not compile `psst-gui`

To learn more, run the command again with --verbose.
==> ERROR: A failure occurred in build().
    Aborting...
error making: psst-git
Originally created by @olligobber on GitHub (Jul 4, 2021). Original GitHub issue: https://github.com/jpochyla/psst/issues/64 When installing from the aur (https://aur.archlinux.org/packages/psst-git/) I got the following error: ``` Compiling psst-gui v0.1.0 (/home/oliver/.cache/yay/psst-git/src/psst/psst-gui) error[E0599]: no function or associated item named `new_with_name` found for struct `MediaControls` in the current scope --> psst-gui/src/controller/playback.rs:87:49 | 87 | let mut media_controls = MediaControls::new_with_name("psst", "Psst"); | ^^^^^^^^^^^^^ function or associated item not found in `MediaControls` error: aborting due to previous error For more information about this error, try `rustc --explain E0599`. error: could not compile `psst-gui` To learn more, run the command again with --verbose. ==> ERROR: A failure occurred in build(). Aborting... error making: psst-git ```
kerem closed this issue 2026-02-28 14:30:15 +03:00
Author
Owner

@luxlurer commented on GitHub (Jul 5, 2021):

+1

<!-- gh-comment-id:873846810 --> @luxlurer commented on GitHub (Jul 5, 2021): +1
Author
Owner

@jpochyla commented on GitHub (Jul 8, 2021):

I'm sorry for the broken build, it should be fixed in master now.

<!-- gh-comment-id:876490676 --> @jpochyla commented on GitHub (Jul 8, 2021): I'm sorry for the broken build, it should be fixed in master now.
Author
Owner

@graynk commented on GitHub (Aug 17, 2021):

When I build from master on Linux I still get this:

error[E0599]: no function or associated item named `new_with_name` found for struct `MediaControls` in the current scope
  --> psst-gui/src/controller/playback.rs:87:49
   |
87 |         let mut media_controls = MediaControls::new_with_name("psst", "Psst");
   |                                                 ^^^^^^^^^^^^^ function or associated item not found in `MediaControls`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0599`.
error: could not compile `psst-gui`

Seems like MediaControls now has only new() constructorm which accepts PlatformConfig

I hacked this together and it compiled:

#[cfg(not(target_os = "windows"))]
let hwnd = None;
#[cfg(target_os = "windows")]
let hwnd = {
    use raw_window_handle::windows::WindowsHandle;

    let handle: WindowsHandle = unimplemented!();
    Some(handle.hwnd)
};
let config = PlatformConfig {
    dbus_name: "psst",
    display_name: "Psst",
    hwnd,
};
let mut media_controls = MediaControls::new(config).unwrap();

Media Controls via gnome extensions / media keys seem to work as well

<!-- gh-comment-id:900114782 --> @graynk commented on GitHub (Aug 17, 2021): When I build from master on Linux I still get this: ```Bash error[E0599]: no function or associated item named `new_with_name` found for struct `MediaControls` in the current scope --> psst-gui/src/controller/playback.rs:87:49 | 87 | let mut media_controls = MediaControls::new_with_name("psst", "Psst"); | ^^^^^^^^^^^^^ function or associated item not found in `MediaControls` error: aborting due to previous error For more information about this error, try `rustc --explain E0599`. error: could not compile `psst-gui` ``` Seems like MediaControls now has only `new()` constructorm which accepts `PlatformConfig` I hacked this together and it compiled: ```Rust #[cfg(not(target_os = "windows"))] let hwnd = None; #[cfg(target_os = "windows")] let hwnd = { use raw_window_handle::windows::WindowsHandle; let handle: WindowsHandle = unimplemented!(); Some(handle.hwnd) }; let config = PlatformConfig { dbus_name: "psst", display_name: "Psst", hwnd, }; let mut media_controls = MediaControls::new(config).unwrap(); ``` Media Controls via gnome extensions / media keys seem to work as well
Author
Owner

@etcet commented on GitHub (Aug 17, 2021):

I had this same problem but it was because I had run cargo update in the repo. From a clean repo it built fine.

<!-- gh-comment-id:900634549 --> @etcet commented on GitHub (Aug 17, 2021): I had this same problem but it was because I had run `cargo update` in the repo. From a clean repo it built fine.
Author
Owner

@graynk commented on GitHub (Aug 18, 2021):

I had this same problem but it was because I had run cargo update in the repo. From a clean repo it built fine.

I looked at the bash history and I indeed I did, sorry for the bother

<!-- gh-comment-id:900824211 --> @graynk commented on GitHub (Aug 18, 2021): > I had this same problem but it was because I had run `cargo update` in the repo. From a clean repo it built fine. I looked at the bash history and I indeed I did, sorry for the bother
Author
Owner

@jpochyla commented on GitHub (Aug 18, 2021):

Fixed in latest master.

<!-- gh-comment-id:900951863 --> @jpochyla commented on GitHub (Aug 18, 2021): Fixed in latest master.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/psst#46
No description provided.