Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: smoltcp-rs/smoltcp
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: a1910baa911e
Choose a base ref
...
head repository: smoltcp-rs/smoltcp
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: a98a80e5d348
Choose a head ref
  • 2 commits
  • 2 files changed
  • 1 contributor

Commits on Jul 29, 2017

  1. Simplify signature of UdpSocket::send_slice.

    UdpSocket::send_slice always returns Ok(data.len()) or an error,
    so the result isn't meaningful.
    whitequark committed Jul 29, 2017
    Copy the full SHA
    0482afc View commit details

Commits on Jul 30, 2017

  1. Update README.

    Fixes #30.
    whitequark committed Jul 30, 2017
    Copy the full SHA
    a98a80e View commit details
Showing with 5 additions and 5 deletions.
  1. +1 −1 README.md
  2. +4 −4 src/socket/udp.rs
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@ include complicated compile-time computations, such as macro or type tricks, eve
at cost of performance degradation.

_smoltcp_ does not need heap allocation *at all*, is [extensively documented][docs],
and compiles on stable Rust 1.18 and later.
and compiles on stable Rust 1.19 and later.

[docs]: https://docs.rs/smoltcp/

8 changes: 4 additions & 4 deletions src/socket/udp.rs
Original file line number Diff line number Diff line change
@@ -146,9 +146,9 @@ impl<'a, 'b> UdpSocket<'a, 'b> {
/// Enqueue a packet to be sent to a given remote endpoint, and fill it from a slice.
///
/// See also [send](#method.send).
pub fn send_slice(&mut self, data: &[u8], endpoint: IpEndpoint) -> Result<usize> {
pub fn send_slice(&mut self, data: &[u8], endpoint: IpEndpoint) -> Result<()> {
self.send(data.len(), endpoint)?.copy_from_slice(data);
Ok(data.len())
Ok(())
}

/// Dequeue a packet received from a remote endpoint, and return the endpoint as well
@@ -294,7 +294,7 @@ mod test {
assert_eq!(socket.send_slice(b"abcdef",
IpEndpoint { port: 0, ..REMOTE_END }),
Err(Error::Unaddressable));
assert_eq!(socket.send_slice(b"abcdef", REMOTE_END), Ok(6));
assert_eq!(socket.send_slice(b"abcdef", REMOTE_END), Ok(()));
}

#[test]
@@ -316,7 +316,7 @@ mod test {
unreachable!()
}), Err(Error::Exhausted) as Result<()>);

assert_eq!(socket.send_slice(b"abcdef", REMOTE_END), Ok(6));
assert_eq!(socket.send_slice(b"abcdef", REMOTE_END), Ok(()));
assert_eq!(socket.send_slice(b"123456", REMOTE_END), Err(Error::Exhausted));
assert!(!socket.can_send());