Add build variants with feature trace
, fix build for those variants.
This commit is contained in:
parent
93ac105fbe
commit
a8a00555b5
3 changed files with 9 additions and 7 deletions
|
@ -1,12 +1,13 @@
|
|||
#!/usr/bin/env bash
|
||||
set -ex
|
||||
|
||||
# A simple build script to run locally.
|
||||
# A simple build script to run locally before pushing.
|
||||
|
||||
for tc in stable beta nightly; do
|
||||
for tc in nightly stable beta; do
|
||||
echo "Toolchain: ${tc}";
|
||||
rustup toolchain update ${tc};
|
||||
cargo +${tc} test --verbose;
|
||||
cargo +${tc} test --verbose --no-default-features;
|
||||
cargo +${tc} test --verbose --features=trace;
|
||||
cargo +${tc} doc --verbose;
|
||||
done
|
||||
|
|
|
@ -6,4 +6,5 @@ set -x
|
|||
|
||||
cargo test --verbose;
|
||||
cargo test --verbose --no-default-features;
|
||||
cargo test --verbose --no-default-features --features=trace;
|
||||
cargo doc --verbose;
|
||||
|
|
10
src/lib.rs
10
src/lib.rs
|
@ -198,7 +198,7 @@ pub fn encode_to_slice(p: &Payload, dest: &mut [u8]) -> Result<usize> {
|
|||
dest[footer_idx] = FRAME_END_SYMBOL;
|
||||
|
||||
#[cfg(feature = "trace")] {
|
||||
println!("framed: Frame code = {:?}", dest[0..(footer_idx + 1)]);
|
||||
println!("framed: Frame code = {:?}", &dest[0..(footer_idx + 1)]);
|
||||
}
|
||||
Ok(cobs_len + HEADER_LEN + FOOTER_LEN)
|
||||
}
|
||||
|
@ -266,16 +266,16 @@ pub fn decode_to_slice(e: &Encoded, mut dest: &mut [u8])
|
|||
let body = &e[0..(e.len()-1)];
|
||||
|
||||
let len = cobs::decode(body, &mut dest)
|
||||
.map_err(|_| Error::CobsDecodeFailed);
|
||||
.map_err(|_| Error::CobsDecodeFailed)?;
|
||||
|
||||
#[cfg(feature = "trace")] {
|
||||
println!("framed: frame = {:?}\n\
|
||||
println!("framed: dest = {:?}\n\
|
||||
framed: body = {:?}\n\
|
||||
framed: decoded = {:?}",
|
||||
frame, body, dest[0..len]);
|
||||
&dest, body, &dest[0..len]);
|
||||
}
|
||||
|
||||
Ok(len?)
|
||||
Ok(len)
|
||||
}
|
||||
|
||||
/// Decode the supplied encoded frame, returning the payload on the heap.
|
||||
|
|
Loading…
Reference in a new issue