[-] AsudoxDev@programming.dev 1 points 2 years ago* (last edited 2 years ago)

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.

[-] AsudoxDev@programming.dev 1 points 2 years ago

rusty software incoming

[-] AsudoxDev@programming.dev 1 points 2 years ago

You also can degause the hard drives.

[-] AsudoxDev@programming.dev 1 points 2 years ago

That assumes that the system has the gnupg utility.

[-] AsudoxDev@programming.dev 1 points 2 years ago

That's not really my problem with GOG. It's the fact that they seem to be ignoring Linux. If they are that unwilling to make a Linux client, then I also don't want to use their platform.

[-] AsudoxDev@programming.dev 1 points 2 years ago

Just block it and you'll no longer see any posts or comments of it.

[-] AsudoxDev@programming.dev 1 points 2 years ago

None of the mod bots seem to be written in Rust, which I'll be using. So nope.

[-] AsudoxDev@programming.dev 1 points 2 years ago

The bot won't have any admin permissions.

[-] AsudoxDev@programming.dev 1 points 2 years ago* (last edited 2 years ago)
view more: ‹ prev next ›

AsudoxDev

0 post score
0 comment score
joined 2 years ago