summaryrefslogtreecommitdiff
path: root/src/context.rs
diff options
context:
space:
mode:
authorNanoTech2016-12-08 09:20:39 +0000
committerNanoTech2017-03-10 23:48:28 -0600
commit0b2d2ccee2023198d60b48154b9b211e47b782ec (patch)
tree2da08badda644c47cd6b93322a9aeb6e994c2527 /src/context.rs
parente72192c0c1825f36f054263437029d05d717c957 (diff)
Replace Cow<'i, str> with &'i str in Expr
Cow::Owned is never used in Expr
Diffstat (limited to '')
-rw-r--r--src/context.rs5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/context.rs b/src/context.rs
index 4d6abf2..b72182d 100644
--- a/src/context.rs
+++ b/src/context.rs
@@ -1,4 +1,3 @@
-use std::borrow::Cow;
use std::collections::HashMap;
/// A `(Context a)` associates `Text` labels with values of type `a`
@@ -14,7 +13,7 @@ use std::collections::HashMap;
/// `n`th occurrence of a given key.
///
#[derive(Debug, Clone)]
-pub struct Context<'i, T>(HashMap<Cow<'i, str>, Vec<T>>);
+pub struct Context<'i, T>(HashMap<&'i str, Vec<T>>);
impl<'i, T> Context<'i, T> {
/// An empty context with no key-value pairs
@@ -41,7 +40,7 @@ impl<'i, T> Context<'i, T> {
impl<'i, T: Clone> Context<'i, T> {
/// Add a key-value pair to the `Context`
- pub fn insert(&self, k: Cow<'i, str>, v: T) -> Self {
+ pub fn insert(&self, k: &'i str, v: T) -> Self {
let mut ctx = (*self).clone();
{
let m = ctx.0.entry(k).or_insert(vec![]);