/// A key in a structured key-value pair. // These impls must only be based on the as_str() representation of the key // If a new field (such as an optional index) is added to the key they must not affect comparison #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] pubstruct Key<'k> {
key: &'k str,
}
impl<'k> Key<'k> { /// Get a key from a borrowed string. pubfn from_str(key: &'k str) -> Self {
Key { key }
}
/// Get a borrowed string from this key. pubfn as_str(&self) -> &str { self.key
}
/// Try get a string borrowed for the `'k` lifetime from this key. pubfn to_borrowed_str(&self) -> Option<&'k str> { // NOTE: This API leaves room for keys to be owned
Some(self.key)
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.