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
Samuel Karlsson
rtfm-app
Commits
28156ff5
Commit
28156ff5
authored
7 years ago
by
Samuel Karlsson
Browse files
Options
Downloads
Patches
Plain Diff
bare3: tack 2
parent
86421ffa
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
examples/bare3.rs
+6
-4
6 additions, 4 deletions
examples/bare3.rs
with
6 additions
and
4 deletions
examples/bare3.rs
+
6
−
4
View file @
28156ff5
...
...
@@ -13,21 +13,23 @@ use core::str;
extern
crate
cortex_m_debug
;
fn
main
()
{
let
s
=
"ABCD"
;
let
bs
=
s
.as_bytes
();
let
s
:
&
str
=
"ABCD"
;
let
bs
:
&
[
u8
]
=
s
.as_bytes
();
ipln!
(
"s = {}"
,
s
);
ipln!
(
"bs = {:?}"
,
bs
);
ipln!
(
"iterate over slice"
);
let
c
:
u8
;
for
c
in
bs
{
ip!
(
"{},"
,
c
)
ip!
(
"{},"
,
c
)
;
}
let
mut
a
=
[
65
u8
;
4
];
let
mut
a
:
[
u8
;
4
]
=
[
65
;
4
];
//let mut a = [0u8; 4];
ipln!
();
ipln!
(
"iterate iterate using (raw) indexing"
);
let
i
:
usize
;
for
i
in
0
..
s
.len
()
{
ip!
(
"{},"
,
bs
[
i
]);
}
...
...
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