Thanks for understan
Thanks for understan
here, it definitely is shorter, I’ll keep filter_map in mind, thanks:
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()
}
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.
Linux was optimized to be used as a desktop OS?
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.
The needed drivers should be provided by the kernel, so no.
…or any other distro really. I’ve been gaming on vanilla arch linux. It’s pretty stable and low maintenance once you’re done setting it up and don’t tinker much and have backups with something like Timeshift in place. archinstall script makes it really easy to install vanilla arch linux with everything essential configured.
KDE Plasma.
GNOME kind of looks nice but is too strict on customization.
Arch linux official repos seem to have prebuilt binaries ready to installiert: https://archlinux.org/packages/extra/x86_64/ardour/
The whole idea of the fediverse is decentralization and federation. It is a good thing
Checked it out, thanks.
Thanks.
Thanks.
Thanks.
How intensive was it exactly?
Very bad. Spacebar is nowhere as functional as Revolt.
Second one if a constructor or a builder is not an option. 1 is out of the question.
Why are the Lemmy devs asking for this though?
Afaik you can. The frontend interacts with the backend via an API so yes. It’s possible.
Your browser might be deleting cookies by default on exit.
Btw this community is not for such questions. Check rule 3.