use crate::column::Column;
use crate::error::{CudfError, Result};
use crate::table::Table;
use crate::types::checked_i32;
impl Column {
pub fn str_find(&self, target: &str, start: usize) -> Result<Column> {
let result =
cudf_cxx::strings::find::ffi::str_find(&self.inner, target, checked_i32(start)?)
.map_err(CudfError::from_cxx)?;
Ok(Column { inner: result })
}
pub fn str_rfind(&self, target: &str) -> Result<Column> {
let result = cudf_cxx::strings::find::ffi::str_rfind(&self.inner, target)
.map_err(CudfError::from_cxx)?;
Ok(Column { inner: result })
}
pub fn str_starts_with(&self, target: &str) -> Result<Column> {
let result = cudf_cxx::strings::find::ffi::str_starts_with(&self.inner, target)
.map_err(CudfError::from_cxx)?;
Ok(Column { inner: result })
}
pub fn str_ends_with(&self, target: &str) -> Result<Column> {
let result = cudf_cxx::strings::find::ffi::str_ends_with(&self.inner, target)
.map_err(CudfError::from_cxx)?;
Ok(Column { inner: result })
}
pub fn str_contains_multiple(&self, targets: &Column) -> Result<Table> {
let result =
cudf_cxx::strings::find::ffi::str_contains_multiple(&self.inner, &targets.inner)
.map_err(CudfError::from_cxx)?;
Ok(Table { inner: result })
}
pub fn str_find_multiple(&self, targets: &Column) -> Result<Column> {
let result = cudf_cxx::strings::find::ffi::str_find_multiple(&self.inner, &targets.inner)
.map_err(CudfError::from_cxx)?;
Ok(Column { inner: result })
}
pub fn str_find_column(&self, targets: &Column, start: usize) -> Result<Column> {
let result = cudf_cxx::strings::find::ffi::str_find_column(
&self.inner,
&targets.inner,
checked_i32(start)?,
)
.map_err(CudfError::from_cxx)?;
Ok(Column { inner: result })
}
pub fn str_find_instance(&self, target: &str, instance: usize) -> Result<Column> {
let result = cudf_cxx::strings::find::ffi::str_find_instance(
&self.inner,
target,
checked_i32(instance)?,
)
.map_err(CudfError::from_cxx)?;
Ok(Column { inner: result })
}
pub fn str_contains_column(&self, targets: &Column) -> Result<Column> {
let result = cudf_cxx::strings::find::ffi::str_contains_column(&self.inner, &targets.inner)
.map_err(CudfError::from_cxx)?;
Ok(Column { inner: result })
}
pub fn str_starts_with_column(&self, targets: &Column) -> Result<Column> {
let result =
cudf_cxx::strings::find::ffi::str_starts_with_column(&self.inner, &targets.inner)
.map_err(CudfError::from_cxx)?;
Ok(Column { inner: result })
}
pub fn str_ends_with_column(&self, targets: &Column) -> Result<Column> {
let result =
cudf_cxx::strings::find::ffi::str_ends_with_column(&self.inner, &targets.inner)
.map_err(CudfError::from_cxx)?;
Ok(Column { inner: result })
}
}