Skip to main content

## FlatMapInPlaceVec

# Trait FlatMapInPlaceVec

Source

    pub unsafe trait FlatMapInPlaceVec {
        type Elem;

        // Required methods
        fn len(&self) -> usize;
        unsafe fn set_len(&mut self, len: usize);
        fn as_ptr(&self) -> *const Self::Elem;
        fn as_mut_ptr(&mut self) -> *mut Self::Elem;
        fn insert(&mut self, idx: usize, elem: Self::Elem);
    }

Expand description

A vec-like type must implement these operations to support `flat_map_in_place`.

## §Safety

The memory safety of the unsafe block in `flat_map_in_place` relies on impls of this trait implementing all the operations correctly.

## Required Associated Types§

Source

#### type Elem

## Required Methods§

Source

#### fn len(&self) -> usize

Source

#### unsafe fn set_len(&mut self, len: usize)

Source

#### fn as_ptr(&self) -> *const Self::Elem

Source

#### fn as_mut_ptr(&mut self) -> *mut Self::Elem

Source

#### fn insert(&mut self, idx: usize, elem: Self::Elem)

## Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

## Implementations on Foreign Types§

Source§

### impl<T, const N: usize> FlatMapInPlaceVec for SmallVec<[T; N]>

Source§

#### type Elem = T

Source§

#### fn len(&self) -> usize

Source§

#### unsafe fn set_len(&mut self, len: usize)

Source§

#### fn as_ptr(&self) -> *const Self::Elem

Source§

#### fn as_mut_ptr(&mut self) -> *mut Self::Elem

Source§

#### fn insert(&mut self, idx: usize, elem: Self::Elem)

Source§

### impl<T> FlatMapInPlaceVec for ThinVec<T>

Source§

#### type Elem = T

Source§

#### fn len(&self) -> usize

Source§

#### unsafe fn set_len(&mut self, len: usize)

Source§

#### fn as_ptr(&self) -> *const Self::Elem

Source§

#### fn as_mut_ptr(&mut self) -> *mut Self::Elem

Source§

#### fn insert(&mut self, idx: usize, elem: Self::Elem)

Source§

### impl<T> FlatMapInPlaceVec for Vec<T>

Source§

#### type Elem = T

Source§

#### fn len(&self) -> usize

Source§

#### unsafe fn set_len(&mut self, len: usize)

Source§

#### fn as_ptr(&self) -> *const Self::Elem

Source§

#### fn as_mut_ptr(&mut self) -> *mut Self::Elem

Source§

#### fn insert(&mut self, idx: usize, elem: Self::Elem)

## Implementors§