diff --git a/src/disco.rs b/src/disco.rs
index 0acdcb86..b958cce5 100644
--- a/src/disco.rs
+++ b/src/disco.rs
@@ -36,9 +36,9 @@ attributes: [
impl Feature {
/// Create a new `` with the according `@var`.
- pub fn new(var: &str) -> Feature {
+ pub fn new>(var: S) -> Feature {
Feature {
- var: String::from(var)
+ var: var.into(),
}
}
}
@@ -59,6 +59,36 @@ pub struct Identity {
pub name: Option,
}
+impl Identity {
+ /// Create a new ``.
+ pub fn new(category: C, type_: T, lang: L, name: N) -> Identity
+ where C: Into,
+ T: Into,
+ L: Into,
+ N: Into,
+ {
+ Identity {
+ category: category.into(),
+ type_: type_.into(),
+ lang: Some(lang.into()),
+ name: Some(name.into()),
+ }
+ }
+
+ /// Create a new `` without a name.
+ pub fn new_anonymous(category: C, type_: T) -> Identity
+ where C: Into,
+ T: Into,
+ {
+ Identity {
+ category: category.into(),
+ type_: type_.into(),
+ lang: None,
+ name: None,
+ }
+ }
+}
+
impl TryFrom for Identity {
type Err = Error;