From 3c27d7e64f49344a84107db8413cbb06ef09f1af Mon Sep 17 00:00:00 2001 From: fpagliughi Date: Sat, 28 Dec 2019 17:23:20 -0500 Subject: [PATCH] Added Buffer::cancel() --- README.md | 4 ++-- src/buffer.rs | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 0128859..ac498c3 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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. diff --git a/src/buffer.rs b/src/buffer.rs index 2063dfe..f6c207c 100644 --- a/src/buffer.rs +++ b/src/buffer.rs @@ -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(&self, chan: &Channel) -> IntoIter { unsafe { @@ -81,12 +86,7 @@ impl Buffer { let ptr = begin; let step: isize = ffi::iio_buffer_step(self.buf)/mem::size_of::() as isize; - IntoIter { - phantom: PhantomData, - ptr, - end, - step, - } + IntoIter { phantom: PhantomData, ptr, end, step, } } } }