Creates a type `T` from the inner string slice by relying on `T`'s [`FromStr::from_str`] implementation.
(&self)
| 123 | /// Creates a type `T` from the inner string slice by relying on `T`'s [`FromStr::from_str`] |
| 124 | /// implementation. |
| 125 | pub fn parse<T: FromStr>(&self) -> Result<T, T::Err> { |
| 126 | match self { |
| 127 | VersionSegment::Segment { text, .. } | VersionSegment::SubSegment { text } => { |
| 128 | FromStr::from_str(text) |
| 129 | } |
| 130 | } |
| 131 | } |
| 132 | |
| 133 | /// Compares the inner string slice with that of another [`VersionSegment`]. |
| 134 | pub fn str_cmp(&self, other: &VersionSegment) -> Ordering { |