1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
//! `NcCapabilities` use crate::NcPalette; use core::mem::size_of; /// Capabilities, derived from terminfo, environment variables, and queries. pub type NcCapabilities = crate::bindings::ffi::nccapabilities; /// Can we set the "hardware" palette? /// /// Requires the "ccc" terminfo capability, and that the number of colors /// supported is at least the size of our `NcPalette` structure. #[inline] pub fn nccapability_canchangecolor(caps: &NcCapabilities) -> bool { if !caps.can_change_colors { return false; } // CHECK this does the same as: // if(caps.colors < sizeof(p->chans) / sizeof(*p->chans)){ // if (caps.colors as usize) < size_of::<NcPalette>() / size_of::<u32>() { return false; } true }