# Trait rustc_mir_dataflow::framework::GenKill

source ·

    pub trait GenKill<T> {
        // Required methods
        fn gen_(&mut self, elem: T);
        fn kill(&mut self, elem: T);

        // Provided methods
        fn gen_all(&mut self, elems: impl IntoIterator<Item = T>) { ... }
        fn kill_all(&mut self, elems: impl IntoIterator<Item = T>) { ... }
    }

Expand description

The legal operations for a transfer function in a gen/kill problem.

This abstraction exists because there are two different contexts in which we call the methods in `GenKillAnalysis`. Sometimes we need to store a single transfer function that can be efficiently applied multiple times, such as when computing the cumulative transfer function for each block. These cases require a `GenKillSet`, which in turn requires two `BitSet`s of storage. Oftentimes, however, we only need to apply an effect once. In these cases, it is more efficient to pass the `BitSet` representing the state vector directly into the `*_effect` methods as opposed to building up a `GenKillSet` and then throwing it away.

## Required Methods§

source

#### fn gen_(&mut self, elem: T)

Inserts `elem` into the state vector.

source

#### fn kill(&mut self, elem: T)

Removes `elem` from the state vector.

## Provided Methods§

source

#### fn gen_all(&mut self, elems: impl IntoIterator<Item = T>)

Calls `gen` for each element in `elems`.

source

#### fn kill_all(&mut self, elems: impl IntoIterator<Item = T>)

Calls `kill` for each element in `elems`.

## Object Safety§

This trait is not object safe.

## Implementations on Foreign Types§

source§

### impl<T: Idx> GenKill<T> for BitSet<T>

source§

#### fn gen_(&mut self, elem: T)

source§

#### fn kill(&mut self, elem: T)

source§

### impl<T: Idx> GenKill<T> for ChunkedBitSet<T>

source§

#### fn gen_(&mut self, elem: T)

source§

#### fn kill(&mut self, elem: T)

## Implementors§

source§

### impl<T, S: GenKill<T>> GenKill<T> for MaybeReachable<S>

source§

### impl<T: Idx> GenKill<T> for Dual<BitSet<T>>

source§

### impl<T: Idx> GenKill<T> for GenKillSet<T>