Struct Split

Source
pub struct Split;
Expand description

§Split (//flowstdlib/data/split)

Split a string into (possibly) two parts and a possible token, based on a separator.

This function is implemented in a deliberate way to be able to showcase parallelization.

Instead of going through the string in order looking for the separator and gathering an array of sections it takes an alternative approach.

It starts in the middle of the string looking for a separator character from there towards the end. If it finds one then the string is split in two and those two sub-strings are output as an array of strings on the partial output. NOTE that either or both of these two sub-strings may have separators within them, and hence need further subdivision.

For that reason, the partial output is feedback to the string input, and the runtime will serialize the array of strings to the input as separate strings.

If from the middle to the end no separator is found, then it tries from the middle backwards towards the beginning. If a separator is found, the two sub-strings are output on partial output as before.

If no separator is found in either of those cases, then the string doesn’t have any and is output on the token output.

Thus, strings with separators are subdivided until strings without separators are found, and each of those is output as a token.

Due to the splitting and recursion approach, the order of the output tokens is not the order they appear in the string.

§Include using

[[process]]
source = "lib://flowstdlib/data/split"

Trait Implementations§

Source§

impl Debug for Split

Source§

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

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

impl Implementation for Split

Source§

fn run(&self, inputs: &[Value]) -> Result<(Option<Value>, RunAgain)>

The run method is used to execute the function’s implementation

Auto Trait Implementations§

§

impl Freeze for Split

§

impl RefUnwindSafe for Split

§

impl Send for Split

§

impl Sync for Split

§

impl Unpin for Split

§

impl UnwindSafe for Split

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

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 T
where U: TryFrom<T>,

Source§

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.