Struct kle_serial::Key
source · pub struct Key<T = f64>where
T: Real,{Show 19 fields
pub legends: [Option<Legend>; 12],
pub color: Color,
pub x: T,
pub y: T,
pub width: T,
pub height: T,
pub x2: T,
pub y2: T,
pub width2: T,
pub height2: T,
pub rotation: T,
pub rx: T,
pub ry: T,
pub profile: String,
pub switch: Switch,
pub ghosted: bool,
pub stepped: bool,
pub homing: bool,
pub decal: bool,
}Expand description
A struct representing a single key.
Fields§
§legends: [Option<Legend>; 12]The key’s legends. This array is indexed in left to right, top to bottom order as shown in the image below.

Legends that are empty in KLE will be deserialised as None.
color: ColorThe colour of the key
x: TThe X position of the key in keyboard units (19.05 mm or 0.75 in).
Note: KLE has some strange behaviour when it comes to stepped and L-shaped keys. The
‘true’ X position will be less if the key’s x2 field is negative. This behaviour can be
observed by placing an ISO enter in KLE; x is 0.25 and x2 is −0.25.
y: TThe Y position of the key in keyboard units (19.05 mm or 0.75 in).
Note: KLE has some strange behaviour when it comes to stepped and L-shaped keys. The
‘true’ Y position will be less if the key’s y2 field is negative. This behaviour can be
observed by placing an ISO enter in KLE; x is 0.25 and x2 is −0.25.
width: TThe width of the key in keyboard units (19.05 mm or 0.75 in).
height: TThe height of the key in keyboard units (19.05 mm or 0.75 in).
x2: TThe relative X position of a stepped or L-shaped part of the key.
This is set to 0.0 for regular keys, but is used for stepped caps lock and ISO enter keys, amongst others.
y2: TThe relative Y position of a stepped or L-shaped part of the key.
This is set to 0.0 for regular keys, but is used for stepped caps lock and ISO enter keys, amongst others.
width2: TThe width of a stepped or L-shaped part of the key.
This is equal to the width for regular keys, but is used for stepped caps lock and ISO enter keys, amongst others.
height2: TThe height of a stepped or L-shaped part of the key.
This is equal to the height for regular keys, but is used for stepped caps lock and ISO enter keys, amongst others.
rotation: TThe rotation of the key in degrees.
rx: TThe X coordinate for the centre of rotation of the key.
ry: TThe Y coordinate for the centre of rotation of the key.
profile: StringThe keycap profile of the key.
switch: SwitchThe key switch.
ghosted: boolWhether the key is ghosted.
stepped: boolWhether the key is stepped.
homing: boolWhether this is a homing key.
decal: boolWhether this is a decal.