Function smartstring::validate
source · [−]pub fn validate()
Expand description
Validate the crate’s assumptions about String
memory layout.
Because SmartString
makes some assumptions about how String
is
laid out in memory that rustc does not actually guarantee, you should
always run this function in your target environment before using
SmartString
, ideally at the start of your application’s main()
function, so your application will crash as early as possible without
any security risks. You should also run it as part of your application’s
test suite, to catch problems before runtime.
If the assumptions don’t hold, this function will panic.
Example
fn main() {
smartstring::validate();
}