MCPcopy Create free account
hub / github.com/SoftbearStudios/bitcode / with_allocation

Method with_allocation

src/fast.rs:341–347  ·  view source on GitHub ↗

Creates a [`CowSlice`] with an allocation of `vec`. None of `vec`'s elements are kept.

(mut vec: Vec<T>)

Source from the content-addressed store, hash-verified

339impl<'borrowed, T> CowSlice<'borrowed, T> {
340 /// Creates a [`CowSlice`] with an allocation of `vec`. None of `vec`'s elements are kept.
341 pub fn with_allocation(mut vec: Vec<T>) -> Self {
342 vec.clear();
343 Self {
344 slice: [].as_slice().into(),
345 vec,
346 }
347 }
348
349 /// Converts a [`CowSlice`] into its internal allocation. The [`Vec<T>`] is empty.
350 pub fn into_allocation(mut self) -> Vec<T> {

Callers

nothing calls this directly

Calls 2

clearMethod · 0.80
as_sliceMethod · 0.80

Tested by

no test coverage detected