Skip to content

Commit

Permalink
Allow identifying if column labels are meant to be shown
Browse files Browse the repository at this point in the history
  • Loading branch information
CryZe authored May 23, 2022
1 parent 72b8e33 commit bba41bf
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions capi/src/splits_component_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,13 +129,23 @@ pub extern "C" fn SplitsComponentState_is_current_split(
this.splits[index].is_current_split
}

/// Returns the label of a specific column
/// Describes if the columns have labels that are meant to be shown. If this is
/// `false`, no labels are supposed to be visualized.
#[no_mangle]
pub extern "C" fn SplitsComponentState_column_label(this: &SplitsComponentState,index: usize,) -> *const c_char {
let labels = this.column_labels.clone();
if labels.is_none() {
return output_str(&"");
}
let hthing = &labels.unwrap()[index];
return output_str(hthing);
pub extern "C" fn SplitsComponentState_has_column_labels(this: &SplitsComponentState) -> bool {
this.column_labels.is_some()
}

/// Returns the label of the column specified. The list is specified from right
/// to left. You may not provide an out of bounds index.
#[no_mangle]
pub extern "C" fn SplitsComponentState_column_label(
this: &SplitsComponentState,
index: usize,
) -> *const c_char {
output_str(if let Some(labels) = &this.column_labels {
&labels[index]
} else {
""
})
}

0 comments on commit bba41bf

Please sign in to comment.