cudf 0.3.0

Safe Rust bindings for NVIDIA libcudf -- GPU-accelerated DataFrame operations
Documentation
//! String slicing (substring) operations.

use crate::column::Column;
use crate::error::{CudfError, Result};

impl Column {
    /// Extract a substring from each string, from `start` to `stop` (exclusive).
    ///
    /// Use `stop = -1` to slice to end of string.
    pub fn str_slice(&self, start: i32, stop: i32) -> Result<Column> {
        let result = cudf_cxx::strings::slice::ffi::str_slice(&self.inner, start, stop)
            .map_err(CudfError::from_cxx)?;
        Ok(Column { inner: result })
    }

    /// Extract substrings using per-row `starts` and `stops` integer columns.
    ///
    /// Both `starts` and `stops` must be integer columns of the same type
    /// and the same size as this string column.
    pub fn str_slice_column(&self, starts: &Column, stops: &Column) -> Result<Column> {
        let result = cudf_cxx::strings::slice::ffi::str_slice_column(
            &self.inner,
            &starts.inner,
            &stops.inner,
        )
        .map_err(CudfError::from_cxx)?;
        Ok(Column { inner: result })
    }
}