[][src]Function pre::std::string::String__impl__from_raw_parts__

pub fn String__impl__from_raw_parts__()

A stub for the preconditions of the std::string::String::from_raw_parts function.

What is this function?

This function was generated by an impl block inside a extern_crate attribute that looked like this:

This example is not tested
impl String  {
    unsafe fn from_raw_parts(buf : * mut u8, length : usize, capacity : usize) ->
String;
    /* other items omitted */
}

Preconditions on external functions inside of an impl block are attached to empty functions like this one. When the preconditions should be checked, a call to this function is inserted, which triggers checking the preconditions.

This function has preconditions

This function has the following preconditions generated by pre attributes:

  • the memory at buf was allocated with the standard library allocator with an alignment of exactly 1
  • length <= capacity
  • capacity is the capacity that buf was allocated with
  • buf is not used after this call
  • the first length bytes at buf are valid UTF-8

To call the function you need to assure that the preconditions hold:

This example is not tested
#[forward(impl pre::std::string::String)]
#[assure(
    "the memory at `buf` was allocated with the standard library allocator with an alignment of exactly 1",
    reason = "<specify the reason why you can assure this here>"
)]
#[assure(
    length <= capacity,
    reason = "<specify the reason why you can assure this here>"
)]
#[assure(
    "`capacity` is the capacity that `buf` was allocated with",
    reason = "<specify the reason why you can assure this here>"
)]
#[assure(
    "`buf` is not used after this call",
    reason = "<specify the reason why you can assure this here>"
)]
#[assure(
    "the first `length` bytes at `buf` are valid UTF-8",
    reason = "<specify the reason why you can assure this here>"
)]
from_raw_parts(/* parameters omitted */);