-
Notifications
You must be signed in to change notification settings - Fork 125
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: xiarui.xr <[email protected]>
- Loading branch information
1 parent
ea4c169
commit 74f1efa
Showing
5 changed files
with
10 additions
and
10 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,12 @@ | ||
use regex::Regex; | ||
|
||
#[inline] | ||
pub fn is_private_field(name: &str) -> bool { | ||
name.starts_with('_') | ||
} | ||
|
||
#[inline] | ||
pub fn is_valid_kcl_name(name: &str) -> bool { | ||
let re = Regex::new(r#"^[a-zA-Z_][a-zA-Z0-9_]*$"#).unwrap(); | ||
re.is_match(name) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters