Struct spirit::fragment::driver::IdMapping [−][src]
pub struct IdMapping { /* fields omitted */ }
Expand description
An object to map Instruction
s from multiple drivers into instruction sequences not
containing duplicate IDs.
If one Driver
uses services of some other slave drivers, it is up to the master to make
sure instructions gathered from the slaves don’t collide on IDs. This helps in that regard.
It is expected to be used as:
- One mapping per slave driver, but sharing the
IdGen
. - All instructions from the slave are
translate
d through the mapping. - The mapping is only stored and cached if
confirm
is called.
TODO Example
Implementations
pub fn translate<'a, R, I>(
&'a mut self,
id_gen: &'a mut IdGen,
instructions: I
) -> impl Iterator<Item = Instruction<R>> + 'a where
R: 'a,
I: IntoIterator<Item = Instruction<R>> + 'a,
pub fn translate<'a, R, I>(
&'a mut self,
id_gen: &'a mut IdGen,
instructions: I
) -> impl Iterator<Item = Instruction<R>> + 'a where
R: 'a,
I: IntoIterator<Item = Instruction<R>> + 'a,
Assigns new IDs so they are unique within the IdMapping
s sharing the same id_gen
.
This changes the IDs so they are unique. It also changes the IDs used in the drop
instructions to reflect the original changes and DropAll
is
expanded to separate instructions (because in the bigger context of the master, all might
mean resources from other slave drivers).
Lists the IDs that are active in the target (translated).
This can be used to, for example, generate instructions to completely „wipe“ the corresponding driver.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for IdMapping
impl UnwindSafe for IdMapping
Blanket Implementations
Mutably borrows from an owned value. Read more