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_twople
fails. - Unexpected
End - Error struct to represent we’ve reached the end of an iterator. Used for
ResultNext
.
Traits§
- Error
Report - A trait for
Error
s that return a specific message and span structure. - Fallible
Itertools - A slightly modified version of the
Itertools
trait which returnsResult
instead. - Peek
- A trait version of the functionality that
Peekable
provides. - Result
Next - Quickly get a result from an iterator of
Result
s. - Result
Peek - Same as
ResultNext
but for things that implementPeek
. - Spannable
- Trait for objects that provide
Span
information. Used for error messaging. - Unsafe
Next - Forcibly extract an item out of an iterator of
Result
s. - Unsafe
Peek - Same as
UnsafeNext
but 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&str
instead. - 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.