diff options
author | rabite <rabite@posteo.de> | 2019-06-17 18:02:50 +0200 |
---|---|---|
committer | rabite <rabite@posteo.de> | 2019-06-18 12:58:29 +0200 |
commit | a676851aedb61682c329a03728e8d5224d282e73 (patch) | |
tree | f93646f62c09704cf39fce6ab5f00fe148d9dd99 /src/trait_ext.rs | |
parent | 327fbc6cd24726ef8ecbef8f58790cbe78bac16f (diff) |
speed up sized_string_u
Diffstat (limited to 'src/trait_ext.rs')
-rw-r--r-- | src/trait_ext.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/trait_ext.rs b/src/trait_ext.rs new file mode 100644 index 0000000..350138b --- /dev/null +++ b/src/trait_ext.rs @@ -0,0 +1,12 @@ +pub trait ExtractResult<T> { + fn extract(self) -> T; +} + +impl<T> ExtractResult<T> for Result<T,T> { + fn extract(self) -> T { + match self { + Ok(val) => val, + Err(val) => val + } + } +} |