Crate wagon_utils
source ·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§
- Same as
vec!
but callsto_string()
on all the elements.
Structs§
- We failed to convert from some thing to another thing.
- An struct for when
split_to_twople
fails. - Error struct to represent we’ve reached the end of an iterator. Used for
ResultNext
.
Traits§
- A trait for
Error
s that return a specific message and span structure. - A slightly modified version of the [
Itertools
] trait which returnsResult
instead. - A trait version of the functionality that
Peekable
provides. - Quickly get a result from an iterator of
Result
s. - Same as
ResultNext
but for things that implementPeek
. - Trait for objects that provide
Span
information. Used for error messaging. - Forcibly extract an item out of an iterator of
Result
s. - Same as
UnsafeNext
but intended for iterators that allow peeking (such asPeekable
).
Functions§
- Given a list of objects that implement
std::fmt::Display
. Returns a comma separated string. - Given a vector of strings, return a string that has all the values joined by a
,
. Except for the last which is joined byor
. - Same as
comma_separated_with_or
, but takes a vector of&str
instead. - Given a list of values, attempt to normalize them based on their sum.
- Removes the first and last character of a string.
- Removes the first character of a string.
- Removes the first n characters of a string.
- Removes last character of a string.
- Removes all whitespace from a string.
- Given string and a character. Attempt to split the string at that character into 2 distinct parts.
Type Aliases§
- The definition of a Span as used throughout WAGon.