Expand description
Utility methods for the WAGon suite of libraries.
Provides a number of simple functions, as well as a trait version of std::iter::Peekable
and a fallible version of itertools::Itertools.
Macros§
- string_
vec - Same as
vec!but callsto_string()on all the elements.
Structs§
- Conversion
Error - We failed to convert from some thing to another thing.
- Split
Error - An struct for when
split_to_twoplefails. - Unexpected
End - Error struct to represent we’ve reached the end of an iterator. Used for
ResultNext.
Traits§
- Error
Report - A trait for
Errors that return a specific message and span structure. - Fallible
Itertools - A slightly modified version of the
Itertoolstrait which returnsResultinstead. - Peek
- A trait version of the functionality that
Peekableprovides. - Result
Next - Quickly get a result from an iterator of
Results. - Result
Peek - Same as
ResultNextbut for things that implementPeek. - Spannable
- Trait for objects that provide
Spaninformation. Used for error messaging. - Unsafe
Next - Forcibly extract an item out of an iterator of
Results. - Unsafe
Peek - Same as
UnsafeNextbut intended for iterators that allow peeking (such asPeekable).
Functions§
- comma_
separated - Given a list of objects that implement
std::fmt::Display. Returns a comma separated string. - comma_
separated_ with_ or - Given a vector of strings, return a string that has all the values joined by a
,. Except for the last which is joined byor. - comma_
separated_ with_ or_ str - Same as
comma_separated_with_or, but takes a vector of&strinstead. - normalize_
to_ probabilities - Given a list of values, attempt to normalize them based on their sum.
- rem_
first_ and_ last_ char - Removes the first and last character of a string.
- rem_
first_ char - Removes the first character of a string.
- rem_
first_ char_ n - Removes the first n characters of a string.
- rem_
last_ char - Removes last character of a string.
- remove_
whitespace - Removes all whitespace from a string.
- split_
to_ twople - Given string and a character. Attempt to split the string at that character into 2 distinct parts.
Type Aliases§
- Span
- The definition of a Span as used throughout WAGon.