Skip to content

Commit

Permalink
nostr: change TryIntoUrl::Err to Infallible for Url
Browse files Browse the repository at this point in the history
Signed-off-by: Yuki Kishimoto <yukikishimoto@protonmail.com>
  • Loading branch information
yukibtc committed Aug 21, 2024
1 parent 7baf8df commit 455bd8e
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
* nostr: re-write `RawRelayMessage` parsing ([Yuki Kishimoto])
* nostr: update `Event` fields ([Yuki Kishimoto])
* nostr: deprecate `Event::is_*` kind related methods ([Yuki Kishimoto])
* nostr: change `TryIntoUrl::Err` to `Infallible` for `Url` ([Yuki Kishimoto])
* signer: update NIP-04 and NIP-44 methods signature ([Yuki Kishimoto])
* webln: bump `webln` to `v0.3` ([Yuki Kishimoto])
* sdk: bump `lnurl-pay` to `v0.6` ([Yuki Kishimoto])
Expand Down
5 changes: 5 additions & 0 deletions crates/nostr-relay-pool/src/pool/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// Copyright (c) 2023-2024 Rust Nostr Developers
// Distributed under the MIT software license

use core::convert::Infallible;

use async_utility::thread;
use nostr::message::MessageHandleError;
use nostr::types::url;
Expand Down Expand Up @@ -55,4 +57,7 @@ pub enum Error {
/// Notification Handler error
#[error("notification handler error: {0}")]
Handler(String),
/// Infallible
#[error(transparent)]
Infallible(#[from] Infallible),
}
1 change: 1 addition & 0 deletions crates/nostr-relay-pool/src/pool/internal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ impl InternalRelayPool {
}
Ok(())
}

pub async fn remove_all_relays(&self) -> Result<(), Error> {
let mut relays = self.relays.write().await;
for relay in relays.values() {
Expand Down
5 changes: 3 additions & 2 deletions crates/nostr/src/types/url.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
//! Url
use alloc::string::String;
use core::convert::Infallible;
use core::fmt::{self, Debug};
use core::str::FromStr;

Expand All @@ -23,7 +24,7 @@ pub trait TryIntoUrl {
}

impl TryIntoUrl for Url {
type Err = ParseError;
type Err = Infallible;

#[inline]
fn try_into_url(self) -> Result<Url, Self::Err> {
Expand All @@ -32,7 +33,7 @@ impl TryIntoUrl for Url {
}

impl TryIntoUrl for &Url {
type Err = ParseError;
type Err = Infallible;

#[inline]
fn try_into_url(self) -> Result<Url, Self::Err> {
Expand Down

0 comments on commit 455bd8e

Please sign in to comment.