Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
R
rtfm-app
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Per Lindgren
rtfm-app
Commits
53157279
Commit
53157279
authored
7 years ago
by
Per
Browse files
Options
Downloads
Patches
Plain Diff
a function instead of closure (less ergonomic)
parent
68ddbc22
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
examples/parse.rs
+6
-1
6 additions, 1 deletion
examples/parse.rs
with
6 additions
and
1 deletion
examples/parse.rs
+
6
−
1
View file @
53157279
...
...
@@ -26,8 +26,13 @@ enum Command {
Freq
(
u32
),
}
fn
f
(
s
:
&&
str
)
->
bool
{
!
(
s
==
&
""
)
}
fn
parse
(
s
:
&
str
)
->
Result
<
Command
,
&
str
>
{
let
mut
iter
=
s
.split
(
' '
)
.filter
(|
c
|
!
(
c
==
&
""
));
//let mut iter = s.split(' ').filter(|c| !(c == &""));
let
mut
iter
=
s
.split
(
' '
)
.filter
(
f
);
match
iter
.next
()
{
Some
(
"Stop"
)
=>
Ok
(
Command
::
Stop
),
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment