germinal/types

A module containing types in germinal.

Types

Represent any event in terminal.

Currently, this library does not support mouse.

pub type Event {
  FocusGained
  FocusLost
  Key(KeyEvent)
  Paste(String)
  Resize(Int, Int)
}

Constructors

  • FocusGained
  • FocusLost
  • Key(KeyEvent)
  • Paste(String)
  • Resize(Int, Int)

Key code.

pub type KeyCode {
  Backspace
  Enter
  Left
  Right
  Up
  Down
  Home
  End
  PageUp
  PageDown
  Tab
  BackTab
  Delete
  Insert
  F(Int)
  Char(String)
  Null
  Esc
  CapsLock
  ScrollLock
  NumLock
  PrintScreen
  Pause
  Menu
  KeypadBegin
}

Constructors

  • Backspace
  • Enter
  • Left
  • Right
  • Up
  • Down
  • Home
  • End
  • PageUp
  • PageDown
  • Tab
  • BackTab
  • Delete
  • Insert
  • F(Int)
  • Char(String)
  • Null
  • Esc
  • CapsLock
  • ScrollLock
  • NumLock
  • PrintScreen
  • Pause
  • Menu
  • KeypadBegin

Key event.

pub type KeyEvent

The kind of key event.

pub type KeyEventKind {
  Press
  Repeat
  Release
}

Constructors

  • Press
  • Repeat
  • Release

The state of key event.

pub type KeyEventState
pub type KeyModifiers

Functions

pub fn alt_modifier() -> KeyModifiers

Represent the ALT modifier.

pub fn caps_lock_state() -> KeyEventState

Represent the Caps Lock state.

pub fn contains_modifiers(
  parent_modifiers: KeyModifiers,
  child_modifiers: KeyModifiers,
) -> Bool

Return True if parent_modifiers contains child_modifiers. Return False if not.

pub fn contains_state(
  parent_state: KeyEventState,
  child_state: KeyEventState,
) -> Bool

Return True if parent_state contains child_state. Return False if not.

pub fn control_modifier() -> KeyModifiers
pub fn get_key_modifiers(event: KeyEvent) -> KeyModifiers

Return the key modifiers of the key event.

pub fn get_keycode(event: KeyEvent) -> KeyCode

Return the key code of the key event.

pub fn get_keyevent_kind(event: KeyEvent) -> KeyEventKind

Return the kind of the key event.

pub fn get_keyevent_state(event: KeyEvent) -> KeyEventState

Return the state of the key event.

pub fn keypad_state() -> KeyEventState

Represent the KeyPad state.

pub fn none_modifier() -> KeyModifiers

Represent no modifier.

pub fn none_state() -> KeyEventState

Represent no state.

pub fn num_lock_state() -> KeyEventState

Represent the Num Lock state.

pub fn or_modifiers(
  modifiers1: KeyModifiers,
  modifiers2: KeyModifiers,
) -> KeyModifiers

Combine two modifiers.

pub fn or_state(
  state1: KeyEventState,
  state2: KeyEventState,
) -> KeyEventState

Combine two state.

pub fn shift_modifier() -> KeyModifiers

Represent the SHIFT modifier.

Search Document