Struct pretty_trait::Group
[−]
[src]
pub struct Group<T> { /* fields omitted */ }
A wrapper which groups its contents so they will fit onto one line if possible, even if their environment has been broken across multiple lines.
Examples
use pretty_trait::{JoinExt, Group, Sep, to_string}; let max_line = Some(10); let tab_size = 4; let expected_ungrouped = "\ hello , world !"; assert_eq!( to_string( &"hello" .join(Sep(0)) .join(",") .join(Sep(1)) .join("world") .join(Sep(0)) .join("!"), max_line, tab_size, ), expected_ungrouped ); let expected_grouped = "\ hello, world!"; assert_eq!( to_string( &Group::new("hello".join(Sep(0)).join(",")) .join(Sep(1)) .join(Group::new("world".join(Sep(0)).join("!"))), max_line, tab_size, ), expected_grouped, );
Methods
impl<T: Pretty> Group<T>
[src]
Trait Implementations
impl<T: Clone> Clone for Group<T>
[src]
fn clone(&self) -> Group<T>
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<T: Copy> Copy for Group<T>
[src]
impl<T: Debug> Debug for Group<T>
[src]
fn fmt(&self, __arg_0: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more