Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove anyhow dependency #44

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ build = "build.rs"

[dependencies]
futures = "0.3.30"
anyhow = "1.0.79"

[dev-dependencies]
tokio = { version = "1.23.0", features = ["full"] }
Expand Down
6 changes: 2 additions & 4 deletions examples/notify.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
use futures::StreamExt;

#[tokio::main]
async fn main() -> anyhow::Result<()> {
let mut stream = dark_light::subscribe().await?;
async fn main() {
let mut stream = dark_light::subscribe().await.unwrap();
while let Some(mode) = stream.next().await {
println!("System theme changed: {:?}", mode);
}

Ok(())
}
3 changes: 2 additions & 1 deletion src/platforms/freedesktop/notify.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
use std::error::Error;
use ashpd::desktop::settings::Settings;
use futures::{stream, Stream, StreamExt};

use crate::Mode;

pub async fn subscribe() -> anyhow::Result<impl Stream<Item = Mode> + Send> {
pub async fn subscribe() -> Result<impl Stream<Item = Mode> + Send, Box<dyn Error>> {
let initial = stream::once(super::initial_value()).boxed();
let later_updates = Settings::new()
.await?
Expand Down
3 changes: 2 additions & 1 deletion src/platforms/macos/notify.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
use std::task::Poll;
use std::error::Error;

use futures::{stream, Stream};

use crate::{detect, Mode};

pub async fn subscribe() -> anyhow::Result<impl Stream<Item = Mode> + Send> {
pub async fn subscribe() -> Result<impl Stream<Item = Mode> + Send, Box<dyn Error>> {
let mut last_mode = detect();

let stream = stream::poll_fn(move |ctx| -> Poll<Option<Mode>> {
Expand Down
3 changes: 2 additions & 1 deletion src/platforms/websys/notify.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
use std::task::Poll;
use std::error::Error;

use futures::{stream, Stream};

use crate::{detect, Mode};

pub async fn subscribe() -> anyhow::Result<impl Stream<Item = Mode> + Send> {
pub async fn subscribe() -> Result<impl Stream<Item = Mode> + Send, Box<dyn Error>> {
let mut last_mode = detect();

let stream = stream::poll_fn(move |ctx| -> Poll<Option<Mode>> {
Expand Down
3 changes: 2 additions & 1 deletion src/platforms/windows/notify.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
use std::task::Poll;
use std::error::Error;

use futures::{stream, Stream};

use crate::{detect, Mode};

pub async fn subscribe() -> anyhow::Result<impl Stream<Item = Mode> + Send> {
pub async fn subscribe() -> Result<impl Stream<Item = Mode> + Send, Box<dyn Error>> {
let mut last_mode = detect();

let stream = stream::poll_fn(move |ctx| -> Poll<Option<Mode>> {
Expand Down
Loading