worked, and returned a slice of min(s.len(), 100) instead of panicing. This is the behavior I expected coming from Python. This is useful for ensuring input is no larger than a certain size.
I’d find that behavior surprising. Also, couldn’t you just write &s[..min(s.len(), 100)], which would be much clearer that nothing magical is going on, and show what exactly you hope the code will do.