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

Add bech32_{nprofile,nevent,naddr}::relays_to_strings #37

Merged
merged 2 commits into from
Feb 4, 2025

Conversation

ksedgwic
Copy link
Contributor

This accessor safely fetches the optional relay hints from the three mention types that have them

@ksedgwic ksedgwic force-pushed the 2025-01-relays_to_strings branch from a3c6b75 to ce089df Compare January 29, 2025 00:44
@jb55
Copy link
Contributor

jb55 commented Feb 3, 2025

adding this to my list today!

@jb55 jb55 linked an issue Feb 4, 2025 that may be closed by this pull request
@jb55 jb55 self-requested a review February 4, 2025 01:38
src/block.rs Outdated
Comment on lines 75 to 79
pub fn relays_to_strings(&self) -> Vec<String> {
self.relays.relays[0..(self.relays.num_relays as usize)]
.iter()
.map(|block| block.as_str().to_string())
.collect()
}
Copy link
Contributor

@jb55 jb55 Feb 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is not correct, no nostrdb api should require copying data or allocating data on the heap (vec). we probably want to make an iterator for this

@jb55 jb55 requested review from jb55 and removed request for jb55 February 4, 2025 04:39
@ksedgwic ksedgwic force-pushed the 2025-01-relays_to_strings branch from 6383c8d to ad3b345 Compare February 4, 2025 18:50
@ksedgwic
Copy link
Contributor Author

ksedgwic commented Feb 4, 2025

Fixed

@ksedgwic ksedgwic requested a review from jb55 February 4, 2025 19:21
@jb55 jb55 merged commit ad3b345 into damus-io:master Feb 4, 2025
5 checks passed
@jb55
Copy link
Contributor

jb55 commented Feb 4, 2025

thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add bech32_{nprofile,nevent,naddr}::relays_to_strings
2 participants