pub struct List {
pub separator: String,
pub trailing: Trailing,
/* private fields */
}Expand description
A list of code segments separated by a separator
Fields§
§separator: StringThe separator between the items
trailing: TrailingThe trailing mode
Implementations§
Source§impl List
impl List
Sourcepub fn always_trail(self) -> Self
pub fn always_trail(self) -> Self
Create a new code list with trailing separator even if the list is in one line
Sourcepub fn inline_when(self, condition: fn(&List) -> bool) -> Self
pub fn inline_when(self, condition: fn(&List) -> bool) -> Self
Set a condition for displaying the block as one line
Sourcepub fn never_inlined(self) -> Self
pub fn never_inlined(self) -> Self
Set the inline condition to be always false
Sourcepub fn should_inline(&self) -> bool
pub fn should_inline(&self) -> bool
Should the list be displayed in one line
Sourcepub fn should_inline_intrinsic(&self) -> bool
pub fn should_inline_intrinsic(&self) -> bool
Should intrinsicly inline the list
This is used for lists that only contain one item
Trait Implementations§
Source§impl FormatCode for List
impl FormatCode for List
Source§fn size_hint(&self) -> usize
fn size_hint(&self) -> usize
Upperbound for the line count of the code for pre-allocating. Return 0 to skip
Source§fn format_into_vec_with(
&self,
format: &Format,
out: &mut Vec<String>,
connect: bool,
indent: &str,
)
fn format_into_vec_with( &self, format: &Format, out: &mut Vec<String>, connect: bool, indent: &str, )
Emit self with the format in the given output context
Source§fn format_with(&self, format: &Format) -> String
fn format_with(&self, format: &Format) -> String
Emit self with the format as a string
Auto Trait Implementations§
impl Freeze for List
impl RefUnwindSafe for List
impl Send for List
impl Sync for List
impl Unpin for List
impl UnwindSafe for List
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