Trait biodivine_sketchbook::app::state::SessionHelper   
source · pub trait SessionHelper {
    // Provided methods
    fn starts_with<'a, 'b>(
        prefix: &str,
        at_path: &'a [&'b str],
    ) -> Option<&'a [&'b str]> { ... }
    fn matches(expected: &[&str], at_path: &[&str]) -> bool { ... }
    fn invalid_path_error_generic<T>(at_path: &[&str]) -> Result<T, DynError> { ... }
    fn invalid_path_error_specific<T>(
        path: &[&str],
        component: &str,
    ) -> Result<T, DynError> { ... }
    fn clone_payload_str(
        event: &Event,
        component: &str,
    ) -> Result<String, DynError> { ... }
    fn assert_path_length(
        path: &[&str],
        length: usize,
        component: &str,
    ) -> Result<(), DynError> { ... }
    fn assert_payload_empty(
        event: &Event,
        component: &str,
    ) -> Result<(), DynError> { ... }
}Provided Methods§
sourcefn starts_with<'a, 'b>(
    prefix: &str,
    at_path: &'a [&'b str],
) -> Option<&'a [&'b str]>
 
fn starts_with<'a, 'b>( prefix: &str, at_path: &'a [&'b str], ) -> Option<&'a [&'b str]>
A utility function which checks if at_path starts with a specific first segment.
If yes, returns the remaining part of the path.
sourcefn matches(expected: &[&str], at_path: &[&str]) -> bool
 
fn matches(expected: &[&str], at_path: &[&str]) -> bool
A utility function which checks if at_path is exactly
sourcefn invalid_path_error_generic<T>(at_path: &[&str]) -> Result<T, DynError>
 
fn invalid_path_error_generic<T>(at_path: &[&str]) -> Result<T, DynError>
A utility function which emits a generic “invalid path” error.
sourcefn invalid_path_error_specific<T>(
    path: &[&str],
    component: &str,
) -> Result<T, DynError>
 
fn invalid_path_error_specific<T>( path: &[&str], component: &str, ) -> Result<T, DynError>
A utility function which emits a “invalid path” error mentioning specific state’s component.
sourcefn clone_payload_str(event: &Event, component: &str) -> Result<String, DynError>
 
fn clone_payload_str(event: &Event, component: &str) -> Result<String, DynError>
A utility function to get and clone a payload of an event. Errors if payload is empty.
The component specifies which component of the state should be mentioned in the error.
This might be useful to directly mention relevant fields of more complex types.
sourcefn assert_path_length(
    path: &[&str],
    length: usize,
    component: &str,
) -> Result<(), DynError>
 
fn assert_path_length( path: &[&str], length: usize, component: &str, ) -> Result<(), DynError>
A utility function to assert that path has a given length, or emit a DynError otherwise.
The component specifies the state’s component that should be mentioned in the error.
This might be useful to directly mention relevant fields of more complex types.
sourcefn assert_payload_empty(event: &Event, component: &str) -> Result<(), DynError>
 
fn assert_payload_empty(event: &Event, component: &str) -> Result<(), DynError>
A utility function to assert that payload is empty - otherwise, DynError is emitted.
The component specifies which component of the state should be mentioned in the error.
This might be useful to directly mention relevant fields of more complex types.