Skip to content

Commit

Permalink
Merge pull request #526 from MichaelJBerk/columnLabel
Browse files Browse the repository at this point in the history
Add SplitsComponentState_column_label to C API
  • Loading branch information
CryZe authored May 23, 2022
2 parents 8df0a81 + bba41bf commit 244ce30
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions capi/src/splits_component_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,3 +128,24 @@ pub extern "C" fn SplitsComponentState_is_current_split(
) -> bool {
this.splits[index].is_current_split
}

/// 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_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 244ce30

Please sign in to comment.