Struct flowcore::model::route::Route

source ·
pub struct Route { /* private fields */ }
Expand description

A Route defines a particular location within the flow hierarchy and can be used to refer to a function, flow, input or output uniquely

Implementations§

source§

impl Route

Route is used to locate Processes (Flows or Functions), their IOs and sub-elements of a data structure within the flow hierarchy

Examples “/my-flow” -> The flow called “my-flow, anchored at the root of the hierarchy, i.e. the context “/my-flow/sub-flow” -> A flow called “sub-flow” that is within “my-flow” “/my-flow/sub-flow/function” -> A function called “function” within “sub-flow” “/my-flow/sub-flow/function/input_1” -> An IO called “input_1” of “function” “/my-flow/sub-flow/function/input_1/1” -> An array element at index 1 of the Array output from “input_1” “/my-flow/sub-flow/function/input_2/part_a” -> A part of the Json structure output by “input_2” called “part_a”

source

pub fn sub_route_of(&self, other: &Route) -> Option<Route>

sub_route_of returns an Option<Route> indicating if self is a subroute of other (i.e. self is a longer route to an element under the other route) Return values None - self is not a sub-route of other (e.g. (“/my-route1”, “/my-route2”) (e.g. (“/my-route1”, “/my-route1/something”) Some(Route::from(“”)) - self and other are equal (e.g. (“/my-route1”, “/my-route1”) Some(Route::from(diff)) - self is a sub-route of other - with diff added (e.g. (“/my-route1/something”, “/my-route1”)

source

pub fn insert<R: AsRef<str>>(&mut self, sub_route: R) -> &Self

Insert another Route at the front of this Route

source

pub fn extend(&mut self, sub_route: &Route) -> &Self

Extend a Route by appending another Route to the end, adding the ‘/’ separator if needed

source

pub fn pop(&self) -> (Cow<'_, Route>, Option<Route>)

Return the Route that is one level up, if it exists Example: /context/function/output/subroute -> /context/function/output

source

pub fn without_trailing_array_index(&self) -> (Cow<'_, Route>, usize, bool)

Return the io Route without a trailing number (array index) and if it has one or not If the trailing number was present then return the route with a trailing ‘/’

source

pub fn is_array_selector(&self) -> bool

Return true if the Route selects an element from an array

source

pub fn depth(&self) -> usize

Return the depth of the Route used to specify types and subtypes such as “” -> 0 “string” -> 0 “array/string” -> 1 “array/array/string” -> 2

source

pub fn is_empty(&self) -> bool

Return true if this Route is empty, false otherwise

source

pub fn parse_subroute(&self) -> Result<RouteType>

Parse the Route into the specific type of sub-route

source

pub fn parent(&self, name: &Name) -> String

Return the Route the parent of the supplied Name

Trait Implementations§

source§

impl AsRef<str> for Route

source§

fn as_ref(&self) -> &str

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl Clone for Route

source§

fn clone(&self) -> Route

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Route

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for Route

source§

fn default() -> Route

Returns the “default value” for a type. Read more
source§

impl<'de> Deserialize<'de> for Route

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl Display for Route

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl From<&String> for Route

source§

fn from(name: &Name) -> Self

Converts to this type from the input type.
source§

impl From<&str> for Route

source§

fn from(string: &str) -> Self

Converts to this type from the input type.
source§

impl From<String> for Route

source§

fn from(string: String) -> Self

Converts to this type from the input type.
source§

impl FromStr for Route

§

type Err = Error

The associated error which can be returned from parsing.
source§

fn from_str(s: &str) -> Result<Self>

Parses a string s to return a value of this type. Read more
source§

impl Hash for Route

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl Ord for Route

source§

fn cmp(&self, other: &Route) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Selfwhere Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Selfwhere Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Selfwhere Self: Sized + PartialOrd,

Restrict a value to a certain interval. Read more
source§

impl PartialEq for Route

source§

fn eq(&self, other: &Route) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd for Route

source§

fn partial_cmp(&self, other: &Route) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl Serialize for Route

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl Validate for Route

source§

fn validate(&self) -> Result<()>

Validate that a deserialized model data structure is valid for use
source§

impl Eq for Route

source§

impl StructuralEq for Route

source§

impl StructuralPartialEq for Route

Auto Trait Implementations§

§

impl RefUnwindSafe for Route

§

impl Send for Route

§

impl Sync for Route

§

impl Unpin for Route

§

impl UnwindSafe for Route

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<Q, K> Comparable<K> for Qwhere Q: Ord + ?Sized, K: Borrow<Q> + ?Sized,

§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
§

impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> DeserializeOwned for Twhere T: for<'de> Deserialize<'de>,