You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a case where to clone structures like Field, I need to have an additional constraint for T to be Clone, which quickly proliferates through the codebase when T is kept generic.
Is there any specific reason for the Text trait not requiring Clone from the get-go? For the implementations defined in the project, it works just fine:
diff --git a/src/common.rs b/src/common.rs
index c5189fa..f44b5b2 100644
--- a/src/common.rs+++ b/src/common.rs@@ -11,7 +11,7 @@ use crate::position::Pos;
/// Text abstracts over types that hold a string value.
/// It is used to make the AST generic over the string type.
-pub trait Text<'a>: 'a {+pub trait Text<'a>: 'a + Clone {
type Value: 'a + From<&'a str> + AsRef<str> + std::borrow::Borrow<str> + PartialEq + Eq + PartialOrd + Ord + fmt::Debug + Clone;
}
Is there an anticipation that somebody will use an implementation of Text that is not cloneable?
The text was updated successfully, but these errors were encountered:
I have a case where to clone structures like
Field
, I need to have an additional constraint forT
to beClone
, which quickly proliferates through the codebase whenT
is kept generic.Is there any specific reason for the
Text
trait not requiringClone
from the get-go? For the implementations defined in the project, it works just fine:Is there an anticipation that somebody will use an implementation of
Text
that is not cloneable?The text was updated successfully, but these errors were encountered: