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.

alignment

Legends that are empty in KLE will be deserialised as None.

§color: Color

The colour of the key

§x: T

The 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: T

The 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: T

The width of the key in keyboard units (19.05 mm or 0.75 in).

§height: T

The height of the key in keyboard units (19.05 mm or 0.75 in).

§x2: T

The 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: T

The 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: T

The 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: T

The 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: T

The rotation of the key in degrees.

§rx: T

The X coordinate for the centre of rotation of the key.

§ry: T

The Y coordinate for the centre of rotation of the key.

§profile: String

The keycap profile of the key.

§switch: Switch

The key switch.

§ghosted: bool

Whether the key is ghosted.

§stepped: bool

Whether the key is stepped.

§homing: bool

Whether this is a homing key.

§decal: bool

Whether this is a decal.

Trait Implementations§

source§

impl<T> Clone for Key<T>
where T: Real + Clone,

source§

fn clone(&self) -> Key<T>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<T> Debug for Key<T>
where T: Real + Debug,

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<T> Default for Key<T>
where T: Real,

source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<T> RefUnwindSafe for Key<T>
where T: RefUnwindSafe,

§

impl<T> Send for Key<T>
where T: Send,

§

impl<T> Sync for Key<T>
where T: Sync,

§

impl<T> Unpin for Key<T>
where T: Unpin,

§

impl<T> UnwindSafe for Key<T>
where T: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.