Skip to content

Add example#23

Open
kangalio wants to merge 1 commit into
dtolnay:masterfrom
kangalio:example
Open

Add example#23
kangalio wants to merge 1 commit into
dtolnay:masterfrom
kangalio:example

Conversation

@kangalio
Copy link
Copy Markdown

@kangalio kangalio commented May 21, 2023

Fixes #22

Should the example doctest adhere to the MSRV too? If so, I will replace the let-else.

Currently, README.md and the crate root docs are duplicated. Should I fix this via #[doc = include_str!("README.md")] in a separate PR? Gated behind docsrs cfg to comply with MSRV policy.

Comment thread README.md
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could also use is_some_and to simplify, e.g.

pub fn is_identifier(s: &str) -> bool {
   let mut chars = s.chars();
   let first_valid = chars.next().is_some_and(is_xid_start);
   let rest_valid = chars.all(is_xid_continue);
   first_valid && rest_valid
}

Bit verbose, but is also just a matter of preference of course. :)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Regardless just having an example would be much better than the status quo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Put example in Readme

2 participants