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

Packet refactor #9

Merged
merged 3 commits into from Jul 6, 2016
Merged

Conversation

jamesmunns
Copy link
Collaborator

Still planning to add some tests, but please feel free to review. I can also squash the commits once we are ready (I included them in case you wanted to see the steps).

@coveralls
Copy link

coveralls commented Jul 3, 2016

Coverage Status

Coverage decreased (-0.3%) to 83.489% when pulling fb7deac on jamesmunns:packet-refactor into e1b04ce on Covertness:master.

Start modularizing packet

move header into its own chunk, include tests

Move auto_respond as a class method

Move packet into its own file

rename "packet" to "message"

Rename Response and Request to *Type to free up the names

Added request and response, pretty clunky feeling though. How can I refactor this?

Better consistency using "message" for the packet inside a Request/Response

cleanup `use`s a bit

more cleaning

Cleanup before pull request

Add tests

Add response test

Cargo fmt
@jamesmunns
Copy link
Collaborator Author

@Covertness ready to merge.

@coveralls
Copy link

Coverage Status

Coverage decreased (-1.1%) to 82.682% when pulling 57ce239 on jamesmunns:packet-refactor into e1b04ce on Covertness:master.

@ptxmac
Copy link

ptxmac commented Jul 4, 2016

You accidentally removed use coap::{CoAPServer, CoAPClient}; from the README

@jamesmunns
Copy link
Collaborator Author

Thanks for the catch. Is there any way to get cargo test to run the README.md examples so I can catch this in the future?

@coveralls
Copy link

coveralls commented Jul 4, 2016

Coverage Status

Coverage decreased (-1.1%) to 82.682% when pulling f3aae2f on jamesmunns:packet-refactor into e1b04ce on Covertness:master.

@ptxmac
Copy link

ptxmac commented Jul 4, 2016

A quick google search shows that the idea have been raised, but not closed: rust-lang/cargo#383
A possibility would be to try and add something like rustdoc --test README.md to the travis script

@Covertness
Copy link
Owner

The README example has another problem:

fn request_handler(req: CoAPRequest) -> Option<CoAPResponse> {
    println!("Receive request: {:?}", req);
    response
}

response should be request.response or None?

@coveralls
Copy link

Coverage Status

Coverage decreased (-1.1%) to 82.682% when pulling 6049d9f on jamesmunns:packet-refactor into e1b04ce on Covertness:master.

@jamesmunns
Copy link
Collaborator Author

jamesmunns commented Jul 5, 2016

Made changes, the suggested rustdoc command didn't seem to work for me. I will look into this before adding it to the travis script. See below. Thanks again for the spot.

MacBook-Pro-2:coap-rs james$ rustdoc --test README.md 

running 3 tests
test coap_rs_0 ... FAILED
test coap_rs_2 ... FAILED
test coap_rs_1 ... FAILED

failures:

---- coap_rs_0 stdout ----
    <anon>:2:5: 2:23 error: can't find crate for `coap` [E0463]
<anon>:2     extern crate coap;
             ^~~~~~~~~~~~~~~~~~
error: aborting due to previous error
thread 'coap_rs_0' panicked at 'Box<Any>', ../src/libsyntax/errors/mod.rs:613
note: Run with `RUST_BACKTRACE=1` for a backtrace.
thread 'coap_rs_0' panicked at 'couldn't compile the test', ../src/librustdoc/test.rs:275

---- coap_rs_2 stdout ----
    <anon>:1:1: 1:19 error: can't find crate for `coap` [E0463]
<anon>:1 extern crate coap;
         ^~~~~~~~~~~~~~~~~~
error: aborting due to previous error
thread 'coap_rs_2' panicked at 'Box<Any>', ../src/libsyntax/errors/mod.rs:613
thread 'coap_rs_2' panicked at 'couldn't compile the test', ../src/librustdoc/test.rs:275

---- coap_rs_1 stdout ----
    <anon>:1:1: 1:19 error: can't find crate for `coap` [E0463]
<anon>:1 extern crate coap;
         ^~~~~~~~~~~~~~~~~~
error: aborting due to previous error
thread 'coap_rs_1' panicked at 'Box<Any>', ../src/libsyntax/errors/mod.rs:613
thread 'coap_rs_1' panicked at 'couldn't compile the test', ../src/librustdoc/test.rs:275


failures:
    coap_rs_0
    coap_rs_1
    coap_rs_2

test result: FAILED. 0 passed; 3 failed; 0 ignored; 0 measured

@Covertness Covertness merged commit cda8c9c into Covertness:master Jul 6, 2016
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

4 participants