In my opinion, a type signature like this:
fn as_millis(&self) -> u64
immediately says one thing very clearly: the output type is u64
. If one needs to handle (almost) billion-year timescales in millisecond precision, then one should definitely evaluate the type requirements, and it should be obvious that this method is inappropriate. For anyone else wanting non-negative millisecond numbers this is fine, so just panic on overflow (just like integer arithmetic does on overflow).