Skip to content
Discussion options

You must be logged in to vote

You also have Option<&PyList>. I would describe it like this:

  • Option<&PyList> does no type checking on the contents, so will be fastest argument to accept but you will have to accept performance cost and fallibility later when you get items from this list and need to check if they are strings.
  • Option<Vec<&str>> has checked all contents and placed them into a Rust Vec. This is a much more expensive task than just accepting &PyList, but you are now free to work with this data purely using Rust algorithms.
  • Option<Vec<String>> is the same but now you've also copied all the text data into new String structures. This is more expensive again, but helpful if you need to keep ownership of the tex…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@sun-rs
Comment options

@davidhewitt
Comment options

Answer selected by sun-rs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants