Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed Getting Started #1

Closed
wants to merge 1 commit into from
Closed

Conversation

Erhannis
Copy link

@Erhannis Erhannis commented Nov 6, 2024

I like the straightforwardness of the "Getting Started" section, except it doesn't work. It says to add to Cargo.toml

[dependencies]
micropb = "0.1"

[build-dependencies]
# Allow types from `heapless` to be used for container fields
micropb-gen = { version = "0.1", features = ["container-heapless"] }

But 1. cargo build tells me essentially to use "0.1.0" rather than "0.1", and then, 2. tells me micropb-gen doesn't have container-heapless. After enabling container-heapless on micropb instead, I then 3. need to add the example.proto file given later, and 4. write example::example_::Example instead of example::Example and 5. import PbEncoder. THEN it appears to work, after filling in the example code. 6. For immediate out-of-the-box compilation, I reordered the example code to serialize an Example, then deserialize the bytes.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Comment on lines +60 to +61
syntax = "proto3";

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't need those 2 lines

Comment on lines +65 to +77
int32 f_int32 = 1;
int64 f_int64 = 2;
uint32 f_uint32 = 3;
uint64 f_uint64 = 4;
sint32 f_sint32 = 5;
sint64 f_sint64 = 6;
bool f_bool = 7;
fixed32 f_fixed32 = 8;
fixed64 f_fixed64 = 9;
sfixed32 f_sfixed32 = 10;
sfixed64 f_sfixed64 = 11;
float f_float = 12;
double f_double = 13;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't need all these fields. Just put a comment saying something like "fields here"

@YuhanLiin
Copy link
Owner

The "Getting Started" section isn't meant to be a full example, but rather a basic template for using micropb. For a full example, I've linked the arm-app example in the README, and there's also more code examples later in the docs. 1, 2, 5, and 6 are great fixes. However, filling additional lines into the example isn't needed unless it's necessary for the code to compile, since I'd like to keep the example brief. For 3, it makes sense to include the example proto file, but the fields aren't necessary to include. 4 isn't needed if the proto file doesn't include package example.

@YuhanLiin
Copy link
Owner

Also you need to make sure both README.md and micropb/README.md are identical.

@YuhanLiin
Copy link
Owner

I've fixed the README Getting Started section with a more complete example, so this issue can be closed. If you continue having issues feel free to reopen.

@YuhanLiin YuhanLiin closed this Nov 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants