Skip to content

Commit

Permalink
Added Buffer::cancel()
Browse files Browse the repository at this point in the history
  • Loading branch information
fpagliughi committed Dec 28, 2019
1 parent 801c071 commit 3c27d7e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ The current version is a wrapper around the user-space C library, [libiio](https

This is a pre-release verion of the crate. The API is stabilizing, but is still under active development and may change before a final release.

This initial development work wrappers a _specific_ version (v0.18) of _libiio_. It assumes that the library is installed on the target system.
This initial development work wrappers a _specific_ version (v0.18) of _libiio_. It assumes that the library is pre-installed on the target system.

## Latest News

Expand All @@ -21,7 +21,7 @@ An effort is underway to get this crate to production quality. This will hopeful
- A complete set of working examples.
- Unit tests and CI

### Unreleased features in this branch:
### New in v0.2

- Support for libiio v0.18
- Further implementation of _libiio_ functions for contexts, devices, channels, etc.
Expand Down
12 changes: 6 additions & 6 deletions src/buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@ impl Buffer {
sys_result(ret as i32, ret as usize)
}

/// Cancel all buffer operations.
pub fn cancel(&mut self) {
unsafe { ffi::iio_buffer_cancel(self.buf); }
}

/// Gets an iterator for the data from a channel.
pub fn channel_iter<T>(&self, chan: &Channel) -> IntoIter<T> {
unsafe {
Expand All @@ -81,12 +86,7 @@ impl Buffer {
let ptr = begin;
let step: isize = ffi::iio_buffer_step(self.buf)/mem::size_of::<T>() as isize;

IntoIter {
phantom: PhantomData,
ptr,
end,
step,
}
IntoIter { phantom: PhantomData, ptr, end, step, }
}
}
}
Expand Down

0 comments on commit 3c27d7e

Please sign in to comment.