Skip to content

Commit

Permalink
docs: specify what from_str expects
Browse files Browse the repository at this point in the history
While you can clearly examine the source to see the conversion
expression, specify the method in the doc comment as well.
  • Loading branch information
kchibisov authored May 9, 2023
1 parent 2b26b50 commit 92dd3e6
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,11 @@ impl core::fmt::Display for CursorIcon {
impl core::str::FromStr for CursorIcon {
type Err = ParseError;

/// Parse a string slice into [`CursorIcon`].
///
/// The `name` is a lower kebab case [`CursorIcon`] varaint name, e.g.
/// `nesw-resize`. The set of possible valid `name` values matches exactly
/// the set of [`CursorIcon::name`] outputs.
fn from_str(name: &str) -> Result<Self, Self::Err> {
match name {
"default" => Ok(CursorIcon::Default),
Expand Down

0 comments on commit 92dd3e6

Please sign in to comment.