AsudoxDev

joined 1 year ago
[–] [email protected] 1 points 5 months ago* (last edited 5 months ago) (2 children)

Here's what you are trying to do, with a one liner:

fn get_links(mut link_nodes: Select) -> Vec<String> {
    link_nodes.retain(|node| node.value().attr("href").is_some()).into_iter().fold(Vec::new(), |links, node| links.push(link.value().attr("href").unwrap().to_string()))
}

edit: shorter and updated version:

fn get_links(mut link_nodes: Select) -> Vec<String> {
    link_nodes.into_iter().filter_map(|node| node.value().attr("href").map(|href| href.to_string())).collect()
}

The retain method is to get rid of all the nodes which don't have a href attribute and the fold method after it is to extract the href out of the nodes and push them into the vector.

It might work or not, I've written this from my memory and I can't exactly know what that Select is.

I also hope you begin reading The Book without half assing it.

[–] [email protected] 7 points 5 months ago* (last edited 5 months ago) (1 children)

No problem calling third parties Russian spies without evidence. But waging a genocide does not make one a Nazi.

I don't care what americans say about third parties, I am not one of them, nor do I want to be one. I simply stated that a nazi is not one who supports genocide, by definition. Would you call helping some random stranger that happens to be supporting trump (which supports genocide) helping a nazi intentionally?

By your logic, anyone that supports genocide is a trump fan, hitler fan, etc.

[–] [email protected] 4 points 5 months ago (1 children)

Linux was optimized to be used as a desktop OS?

[–] [email protected] 7 points 5 months ago (6 children)

By the actual definition, that is wrong. https://en.wikipedia.org/wiki/Nazism

[–] [email protected] 9 points 5 months ago* (last edited 5 months ago) (8 children)

They are in an illusion where their backend is absolutely perfect, but third party apps like open source keyboards implement spyware that spies on users predictable bank passwords. (FlorisBoard is the biggest predator)

[–] [email protected] 11 points 5 months ago

They should upgrade soon. One of the LW admins said that they were waiting for this release.

[–] [email protected] 8 points 5 months ago

A new official UI is coming, which might improve the UX.

[–] [email protected] 3 points 5 months ago (2 children)

through the lens of Lemmy-UI (IMO the worst way to interact with Lemmy).

Why?

[–] [email protected] 6 points 5 months ago* (last edited 5 months ago)

Please explain what it is you are trying to do.

As far as I can understand from the function return value and the body of the function, you are trying to compose all of the href attributes in each node into a single String, which is encapsulated in an Option. Is this correct? Something looks weird but I can't quite catch it. I hope you didn't take a quick glance over the rust book and just started assuming things work like JS in Rust.

[–] [email protected] 3 points 5 months ago

Yes but they have KYC.

[–] [email protected] 2 points 5 months ago

you fuck off from this community

[–] [email protected] 15 points 5 months ago

Lemmy does not have a modmail system yet. I opened a feature request regarding this a few months ago, check it out: https://github.com/LemmyNet/lemmy/issues/5110

view more: ‹ prev next ›