Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add SplitsComponentState_column_label to C API #526

Merged
merged 2 commits into from
May 23, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 {
""
})
}