summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Unterwaditzer <markus@unterwaditzer.net>2015-01-15 18:18:56 +0100
committerMarkus Unterwaditzer <markus@unterwaditzer.net>2015-01-15 18:19:36 +0100
commit1697fc0ecfd86d770deb7a9824bd8f2376606313 (patch)
treee81fcdca3b7e18babd5b16de3dbc56e52d74997d
parent1758605f7b25fa125c7a2a6b5c5cc94b9f5849fa (diff)
Add convenience method for quickly creating props
-rw-r--r--src/vobject/lib.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/vobject/lib.rs b/src/vobject/lib.rs
index fa28c7f..d5ff1ed 100644
--- a/src/vobject/lib.rs
+++ b/src/vobject/lib.rs
@@ -30,6 +30,11 @@ impl Property {
}
}
+ /// Create property from unescaped string.
+ pub fn new_from_string(s: &str) -> Property {
+ Property::new(HashMap::new(), escape_chars(s), None)
+ }
+
/// Get value as unescaped string.
pub fn value_as_string(&self) -> String {
unescape_chars(self.raw_value.as_slice())