pub struct StateMapping {
pub input_mapping: HashMap<String, String>,
pub output_mapping: HashMap<String, String>,
pub passthrough: Vec<String>,
pub merge_all: bool,
pub output_prefix: Option<String>,
}Expand description
State mapping configuration between parent and child graphs
Fields§
§input_mapping: HashMap<String, String>Map parent keys to child keys (parent_key -> child_key)
output_mapping: HashMap<String, String>Map child keys back to parent keys (child_key -> parent_key)
passthrough: Vec<String>Keys to pass through unchanged (same key in both)
merge_all: boolWhether to merge all child state back (vs only mapped keys)
output_prefix: Option<String>Prefix for child keys when merging all
Implementations§
Source§impl StateMapping
impl StateMapping
Sourcepub fn map_input(
self,
parent_key: impl Into<String>,
child_key: impl Into<String>,
) -> Self
pub fn map_input( self, parent_key: impl Into<String>, child_key: impl Into<String>, ) -> Self
Map a parent key to a child key on input
Sourcepub fn map_output(
self,
child_key: impl Into<String>,
parent_key: impl Into<String>,
) -> Self
pub fn map_output( self, child_key: impl Into<String>, parent_key: impl Into<String>, ) -> Self
Map a child key back to a parent key on output
Sourcepub fn passthrough(self, key: impl Into<String>) -> Self
pub fn passthrough(self, key: impl Into<String>) -> Self
Add a passthrough key (same name in parent and child)
Sourcepub fn passthrough_keys(self, keys: Vec<String>) -> Self
pub fn passthrough_keys(self, keys: Vec<String>) -> Self
Add multiple passthrough keys
Sourcepub fn with_prefix(self, prefix: impl Into<String>) -> Self
pub fn with_prefix(self, prefix: impl Into<String>) -> Self
Set prefix for merged keys
Sourcepub fn apply_input(&self, parent_state: &GraphState) -> GraphState
pub fn apply_input(&self, parent_state: &GraphState) -> GraphState
Apply input mapping: parent state -> child state
Sourcepub fn apply_output(
&self,
parent_state: &GraphState,
child_state: &GraphState,
) -> GraphState
pub fn apply_output( &self, parent_state: &GraphState, child_state: &GraphState, ) -> GraphState
Apply output mapping: child state -> updated parent state
Trait Implementations§
Source§impl Clone for StateMapping
impl Clone for StateMapping
Source§fn clone(&self) -> StateMapping
fn clone(&self) -> StateMapping
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for StateMapping
impl Debug for StateMapping
Source§impl Default for StateMapping
impl Default for StateMapping
Source§fn default() -> StateMapping
fn default() -> StateMapping
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for StateMapping
impl RefUnwindSafe for StateMapping
impl Send for StateMapping
impl Sync for StateMapping
impl Unpin for StateMapping
impl UnsafeUnpin for StateMapping
impl UnwindSafe for StateMapping
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more