Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
ham-cats
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
Package Registry
Model registry
Operate
Environments
Terraform modules
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
Erik DontWantToAtThisTime
ham-cats
Commits
7ccb3c8d
Unverified
Commit
7ccb3c8d
authored
7 months ago
by
Erik Fong
Browse files
Options
Downloads
Patches
Plain Diff
Consolidated the debug units into a single struct implementation.
parent
de043248
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
src/whisker/gps.rs
+10
-26
10 additions, 26 deletions
src/whisker/gps.rs
with
10 additions
and
26 deletions
src/whisker/gps.rs
+
10
−
26
View file @
7ccb3c8d
...
...
@@ -104,37 +104,21 @@ impl Gps {
impl
Debug
for
Gps
{
fn
fmt
(
&
self
,
f
:
&
mut
core
::
fmt
::
Formatter
)
->
core
::
fmt
::
Result
{
f
.debug_struct
(
"Gps"
)
.field
(
"latitude"
,
&
Debug
Degrees
Units
(
self
.latitude
()))
.field
(
"longitude"
,
&
Debug
Degrees
Units
(
self
.longitude
()))
.field
(
"altitude"
,
&
Debug
Meter
Units
(
self
.altitude
))
.field
(
"max_error"
,
&
Debug
Meter
Units
(
self
.max_error
))
.field
(
"heading"
,
&
Debug
Degrees
Units
(
self
.heading
()))
.field
(
"speed"
,
&
Debug
MeterPerSecond
Units
(
self
.speed
))
.field
(
"latitude"
,
&
DebugUnits
(
self
.latitude
()
,
"°"
))
.field
(
"longitude"
,
&
DebugUnits
(
self
.longitude
()
,
"°"
))
.field
(
"altitude"
,
&
DebugUnits
(
self
.altitude
,
" m"
))
.field
(
"max_error"
,
&
DebugUnits
(
self
.max_error
,
" m"
))
.field
(
"heading"
,
&
DebugUnits
(
self
.heading
()
,
"°"
))
.field
(
"speed"
,
&
DebugUnits
(
self
.speed
,
" m/s"
))
.finish
()
}
}
struct
Debug
DegreesUnits
<
T
>
(
T
);
struct
Debug
Units
<
'a
,
T
>
(
T
,
&
'a
str
);
impl
<
T
:
Display
>
Debug
for
DebugDegreesUnits
<
T
>
{
fn
fmt
(
&
self
,
f
:
&
mut
core
::
fmt
::
Formatter
)
->
core
::
fmt
::
Result
{
write!
(
f
,
"{}°"
,
self
.0
)
}
}
struct
DebugMeterUnits
<
T
>
(
T
);
impl
<
T
:
Display
>
Debug
for
DebugMeterUnits
<
T
>
{
fn
fmt
(
&
self
,
f
:
&
mut
core
::
fmt
::
Formatter
)
->
core
::
fmt
::
Result
{
write!
(
f
,
"{} m"
,
self
.0
)
}
}
struct
DebugMeterPerSecondUnits
<
T
>
(
T
);
impl
<
T
:
Display
>
Debug
for
DebugMeterPerSecondUnits
<
T
>
{
fn
fmt
(
&
self
,
f
:
&
mut
core
::
fmt
::
Formatter
)
->
core
::
fmt
::
Result
{
write!
(
f
,
"{} m/s"
,
self
.0
)
impl
<
'a
,
T
:
Display
>
Debug
for
DebugUnits
<
'a
,
T
>
{
fn
fmt
(
&
self
,
f
:
&
mut
core
::
fmt
::
Formatter
<
'_
>
)
->
core
::
fmt
::
Result
{
write!
(
f
,
"{}{}"
,
self
.0
,
self
.1
)
}
}
...
...
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