Page MenuHomePhabricator

Implement Display and TryFrom traits for DeviceType
ClosedPublic

Authored by will on Oct 5 2023, 9:39 PM.
Tags
None
Referenced Files
F3150049: D9384.id31765.diff
Mon, Nov 4, 6:44 PM
Unknown Object (File)
Fri, Nov 1, 12:02 PM
Unknown Object (File)
Fri, Nov 1, 12:02 PM
Unknown Object (File)
Fri, Nov 1, 12:02 PM
Unknown Object (File)
Fri, Nov 1, 12:02 PM
Unknown Object (File)
Fri, Nov 1, 12:00 PM
Unknown Object (File)
Fri, Nov 1, 12:00 PM
Unknown Object (File)
Fri, Nov 1, 12:00 PM
Subscribers

Details

Summary

Implemented Display and TryFrom impls to generated DeviceType object in grpc_clients/identity/src/device.rs.
Being able to marshal the protobuf into a "more realized" object will likely be useful in the future for both devices and services.

Test Plan

Write unit tests located in grpc_clients/identity/src/device.rs for both Display and TryFrom.

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

will requested review of this revision.Oct 5 2023, 9:57 PM
varun requested changes to this revision.Oct 6 2023, 11:19 AM

can you elaborate a little on your test plan?

shared/grpc_clients/src/error.rs
6–15 ↗(On Diff #31729)

thanks for filling in the placeholder. can you please do something similar for the other variants?

shared/grpc_clients/src/identity/device.rs
1–4 ↗(On Diff #31729)

nit: can we use crate:: instead of super::? i prefer crate:: because if we reorganize files later it's one less thing to think about

and then group the imports like this:

  • Standard library imports
  • External crate imports
  • Workspace crate imports

this is just a best practice thing

This revision now requires changes to proceed.Oct 6 2023, 11:19 AM

Replace placeholder error message formats for grpc_clients

Convert access of DeviceType from super to crate::identity

Export DeviceType in grpc_clients/identity for usage outside of the crate

Display and TryFrom unit tests for DeviceType

This revision is now accepted and ready to land.Oct 9 2023, 3:27 PM