aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorC. Morgan Hamill <me@cmhamill.org>2015-03-27 20:39:02 +0100
committerC. Morgan Hamill <me@cmhamill.org>2015-03-27 20:39:02 +0100
commit9005a1b8656ed0bcd8526810206836eeeb919d38 (patch)
treecaeefae886e669c81b37d46175e879ad15144d08
parented50bef4947c739032f7282054cd41103e9d1192 (diff)
downloadmail-9005a1b8656ed0bcd8526810206836eeeb919d38.tar.gz
Add `NewFromPtr` trait.
Crate-private utility trait for `new()` methods on types.
-rw-r--r--src/utils.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/utils.rs b/src/utils.rs
index b5acb66..af3ce29 100644
--- a/src/utils.rs
+++ b/src/utils.rs
@@ -8,6 +8,10 @@ use std::os::unix::ffi::OsStrExt;
use libc;
+pub trait NewFromPtr<T> {
+ fn new(ptr: T) -> Self;
+}
+
pub trait ToCString {
fn to_cstring(&self) -> Result<ffi::CString, ffi::NulError>;
}