#[non_exhaustive]pub enum Trailing {
Preserve,
Always,
Never,
}Expand description
What to do with a separator after the last element of a delimited list.
Policies other than Preserve change the token
stream (they add or remove one separator token), so they apply only to
lists that are well formed: delimiters present at both ends, elements and
separators strictly alternating, and no error node among the elements.
Anything else is left as written.
§Examples
use fmt_lang::{NodeRule, Space, Trailing};
let array = NodeRule::new("array")
.delimiters("[", "]", Space::SoftLine)
.separator(",", Space::Line, Trailing::Never);Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Preserve
Keep a trailing separator if there is one; never add one.
Always
Ensure a non-empty list ends with a separator.
Never
Remove a trailing separator.
Trait Implementations§
impl Copy for Trailing
impl Eq for Trailing
impl StructuralPartialEq for Trailing
Auto Trait Implementations§
impl Freeze for Trailing
impl RefUnwindSafe for Trailing
impl Send for Trailing
impl Sync for Trailing
impl Unpin for Trailing
impl UnsafeUnpin for Trailing
impl UnwindSafe for Trailing
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