• 2 Posts
  • 87 Comments
Joined 1 year ago
cake
Cake day: November 24th, 2023

help-circle
  • I think I know what happened. Did you do something like PATH="/usr/bin/golang"?

    Because doing that overwrite your path variable. You need to set it like this:

    PATH="{PATH}:/usr/bin/golang" to append to the path.

    And well… I hope you got a backup of your /root/.bashrc or whatever you use as a terminal. Restoring it should fix it

    Edit: you should be able to use any program by appending /usr/bin/ to your commands, as long as it’s in this directory







  • It’s quite simple. Just remove the permalink field! If you are calculating it then no need to store it in the struct.

    If you do need the field to be there (ex you serialise it with serde), then create a method called new that takes everything but the permalink, construct your permalink there, then return a new object.

    Your permalink method can now just be self.permalink.to_string()

    P.S. in the second case I’d recommend to change the return type of self.permalink() to &str. It avoids unnecessary cloning of the string.


  • I wouldn’t mind having a explanation of what you want to do instead of the code. It’s not quite clear what you mean.

    Anyways, what you want is to transform an iterator (your Select) into an iterator of Option<String>?

    For that, there’s multiple ways but here’s the simplest:

    link_nodes.map(|node| node.value().attr("href").to_string())

    Essentially, for each elements, we execute a closure (arrow function in JavaScript) that transform the node into your href string.

    P.S. can’t guarantee it works, I don’t know what this “Select” type is, and I’m programming on mobile