Is it idiomatic to come up with your own Undefined Behavior for your APIs?
Let's say I'm making a library that provides an API for doing something over some data, and I want to both provide an API that correctly checks and performs actions, which is slower, and one that provides functions without checks that can be faster to use in certain circumstances, but if used incorrectly may leave the data in an inconsistent internal state.
But that idea of "inconsistency" is only abstract as per what the data means, and it does not involve having what Rust defines as Undefined Behavior: a boolean that is a proper 0 while it should actually be 1, or a valid array that does not contain all of the items it should, or something else.
Is it reasonable, and is it idiomatic, to mark such faster functions unsafe for other programmers who use the API to have to acknowledge it, even if they really don't use unsafe Rust at all?
(Of course ideally there would not be a need for such an API, and the fully safe and sound one would also be the fastest one, but let's say for the sake of the question there's no other way and I have to include both APIs.)