pub fn as_ptr(&self) -> *const T {
        // We shadow the slice method of the same name to avoid going through
        // `deref`, which creates an intermediate reference.
        let ptr = self.buf.ptr();
        unsafe {
            assume(!ptr.is_null());
        }
        ptr
    }
Forces the length of the vector to `new_len`.

This is a low-level operation that maintains none of the normal
invariants of the type. Normally changing the length of a vector
is done using one of the safe operations instead, such as
[`truncate`], [`resize`], [`extend`], or [`clear`].

[`truncate`]: Vec::truncate
[`resize`]: Vec::resize
[`extend`]: Extend::extend
[`clear`]: Vec::clear

# Safety

- `new_len` must be less than or equal to [`capacity()`].
- The elements at `old_len..new_len` must be initialized.

[`capacity()`]: Vec::capacity

# Examples

This method can be useful for situations in which the vector
is serving as a buffer for other code, particularly over FFI:

```no_run
# #![allow(dead_code)]
# // This is just a minimal skeleton for the doc example;
# // don't use this as a starting point for a real library.
# pub struct StreamWrapper { strm: *mut std::ffi::c_void }
benchmarks/haystacks/code/rust-library.rs