pub unsafe trait UniqueValue {
// Required method
fn get_unique(&self) -> Option<&str>;
}Expand description
Return a reference to value in a collection if it is the only one.
For example, a vector of string like types returns a reference to its first
element if there are no other, else it returns None.
If this were done with slices, that would require choosing a particular
value type of the underlying slice e.g. [String].
Required Methods§
Sourcefn get_unique(&self) -> Option<&str>
fn get_unique(&self) -> Option<&str>
Borrow the unique value reference.