pub struct Seq<T>(pub Vec<T>);Expand description
A wrapper that concatenates an arbitrary sequence of pretty-printable values.
§Examples
Basic usage:
use pretty_trait::{JoinExt, Sep, Seq, to_string};
let max_line = Some(10);
let tab_size = 4;
let expected = "\
lorem
ipsum
dolor
sit
amet";
assert_eq!(
to_string(
&Seq(vec![
"lorem".join(Some(Sep(1))),
"ipsum".join(Some(Sep(1))),
"dolor".join(Some(Sep(1))),
"sit".join(Some(Sep(1))),
"amet".join(None),
]),
max_line,
tab_size,
),
expected
);§Note
Because a Seq is just a thin wrapper around a Vec, all of its items must be of the same
type. When working with combinators like join this can sometimes be confusing. For example,
the following code will not compile because the final element of the Vec does not have the
same type as the others:
ⓘ
Seq(vec![
"lorem".join(Sep(1)),
"ipsum".join(Sep(1)),
"dolor".join(Sep(1)),
"sit".join(Sep(1)),
"amet",
]);Tuple Fields§
§0: Vec<T>Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for Seq<T>
impl<T> RefUnwindSafe for Seq<T>where
T: RefUnwindSafe,
impl<T> Send for Seq<T>where
T: Send,
impl<T> Sync for Seq<T>where
T: Sync,
impl<T> Unpin for Seq<T>where
T: Unpin,
impl<T> UnsafeUnpin for Seq<T>
impl<T> UnwindSafe for Seq<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more