4 /// A type to specify UI label, like an entry in the list of assists. Enforces
9 /// Note the upper-case first letter and the absence of `.` at the end.
11 pub struct Label(String);
13 impl PartialEq<str> for Label {
14 fn eq(&self, other: &str) -> bool {
19 impl PartialEq<&'_ str> for Label {
20 fn eq(&self, other: &&str) -> bool {
25 impl From<Label> for String {
26 fn from(label: Label) -> String {
32 pub fn new(label: String) -> Label {
33 assert!(label.starts_with(char::is_uppercase) && !label.ends_with('.'));
38 impl fmt::Display for Label {
39 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
40 fmt::Display::fmt(&self.0, f)
44 impl fmt::Debug for Label {
45 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
46 fmt::Debug::fmt(&self.0, f)