Created
October 3, 2015 20:49
-
-
Save marcusklaas/f3a5266f75e1bcb6dd7e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pub trait AsRev { | |
fn as_rev(&self) -> &ListItem; | |
} | |
impl AsRev for ListItem { | |
fn as_rev(&self) -> &ListItem { | |
&self | |
} | |
} | |
impl<'a> AsRev for &'a ListItem { | |
fn as_rev(&self) -> &ListItem { | |
self | |
} | |
} | |
pub struct ListItem { | |
pub pre_comment: Option<String>, | |
// Item should include attributes and doc comments. | |
pub item: String, | |
pub post_comment: Option<String>, | |
// Whether there is extra whitespace before this item. | |
pub new_lines: bool, | |
} | |
pub fn definitive_tactic<'t, I, T>(items: I, | |
tactic: ListTactic, | |
width: usize) | |
-> DefinitiveListTactic | |
where I: IntoIterator<Item = T> + Clone, | |
T: AsRev | |
{ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment