[][src]Function pre::alloc::vec::Vec__impl__from_raw_parts__

pub fn Vec__impl__from_raw_parts__()

A stub for the preconditions of the alloc_lib::vec::Vec<T>::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< T > Vec < T >  {
    unsafe fn from_raw_parts(ptr : * mut T, length : usize, capacity : usize) ->
Vec < T >;
    /* 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:

  • ptr has been previously allocated via String or Vec<T>
  • T has the same size and alignment as what ptr was allocated with
  • length <= capacity
  • capacity is the capacity that ptr was allocated with
  • ptr is not used after this call

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

This example is not tested
#[forward(impl pre::alloc::vec::Vec)]
#[assure(
    "`ptr` has been previously allocated via `String` or `Vec<T>`",
    reason = "<specify the reason why you can assure this here>"
)]
#[assure(
    "`T` has the same size and alignment as what `ptr` was allocated with",
    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 `ptr` was allocated with",
    reason = "<specify the reason why you can assure this here>"
)]
#[assure(
    "`ptr` is not used after this call",
    reason = "<specify the reason why you can assure this here>"
)]
from_raw_parts(/* parameters omitted */);