Mercurial > lbo > hg > localmr
changeset 68:edbfc8c3ff56
Add shortcut function to quickly create Records
author | Lewin Bormann <lbo@spheniscida.de> |
---|---|
date | Sat, 06 Feb 2016 17:07:59 +0000 |
parents | 5bfe21949e22 |
children | ddd39d8ba118 |
files | src/record_types.rs |
diffstat | 1 files changed, 5 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/record_types.rs Sat Feb 06 17:07:36 2016 +0000 +++ b/src/record_types.rs Sat Feb 06 17:07:59 2016 +0000 @@ -8,6 +8,11 @@ pub value: String, } +/// Shortcut for creating a record. +pub fn mk_rcrd(k: &str, v: &str) -> Record { + Record { key: String::from(k), value: String::from(v) } +} + impl PartialOrd for Record { fn partial_cmp(&self, other: &Record) -> Option<Ordering> { Some(match self.key.cmp(&other.key) {