Hare API reference

bonsai+x86_64 +linux

Index

Types

// Undocumented types:
type action = (action_event_received | action_context_changed);
type action_context_changed = struct {
	context_elements: []context_element,
};
type action_event_received = struct {
	event_name: event_name,
};
type context_element = (str, str);
type event_name = str;
type state_machine = struct {
	all_transitions: []*transition,
	available_transitions: []*transition,
	context_elements: []context_element,
	waiting_transition_delay: (*transition_delay | void),
};
type transition = struct {
	_type: str,
	transitions: []*transition,
};
type transition_context = struct {
	transition,
	context_elements: []context_element,
};
type transition_delay = struct {
	transition,
	delay_duration: int,
};
type transition_event = struct {
	transition,
	event_name: event_name,
};
type transition_exec = struct {
	transition,
	command: []str,
};

Errors

// Undocumented Errors:
type bad_syntax = !(unsupported_type | first_isnt_array | transition_isnt_object | missing_transition_type | missing_contexts | missing_event_name | missing_delay_duration | missing_command | type_isnt_str | command_isnt_array | contexts_isnt_object | context_value_isnt_str | transitions_isnt_array | delay_duration_isnt_int | event_name_isnt_str | command_argument_isnt_str);
type command_argument_isnt_str = !void;
type command_isnt_array = !void;
type context_value_isnt_str = !void;
type contexts_isnt_object = !void;
type delay_duration_isnt_int = !void;
type error = !bad_syntax;
type event_name_isnt_str = !void;
type first_isnt_array = !void;
type missing_command = !void;
type missing_contexts = !void;
type missing_delay_duration = !void;
type missing_event_name = !void;
type missing_transition_type = !void;
type transition_isnt_object = !void;
type transitions_isnt_array = !void;
type type_isnt_str = !void;
type unsupported_type = !void;

Functions

// Undocumented functions:
fn context_element_str(literal: str) (context_element | nomem);
fn context_elements_match_all(context_elements: []context_element, to_match_context_elements: []context_element) bool;
fn context_elements_set_key_if_present(context_elements: []context_element, key: str, value: str) (bool | nomem);
fn finish_context_element(elem: context_element) void;
fn finish_context_elements(elems: []context_element) void;
fn finish_state(state: *state_machine) void;
fn finish_transition(transition: *transition) void;
fn finish_transitions(transitions: []*transition) void;
fn load_transitions(source: io::handle) ([]*transition | json::error | error | nomem);
fn state_forward(state: *state_machine, act: action) (bool | nomem);
fn str_context_element(context_element: context_element) (str | nomem);
fn strerror(err: error) str;
fn trigger_transition_delay_expired(state: *state_machine) void;
fn write_transitions(handle: io::handle, transitions: []*transition) (void | io::error);

Types

type action[permalink]

Show undocumented member
type action = (action_event_received | action_context_changed);

type action_context_changed[permalink]

Show undocumented member
type action_context_changed = struct {
	context_elements: []context_element,
};

type action_event_received[permalink]

Show undocumented member
type action_event_received = struct {
	event_name: event_name,
};

type context_element[permalink]

Show undocumented member
type context_element = (str, str);

type event_name[permalink]

Show undocumented member
type event_name = str;

type state_machine[permalink]

Show undocumented member
type state_machine = struct {
	all_transitions: []*transition,
	available_transitions: []*transition,
	context_elements: []context_element,
	waiting_transition_delay: (*transition_delay | void),
};

type transition[permalink]

Show undocumented member
type transition = struct {
	_type: str,
	transitions: []*transition,
};

type transition_context[permalink]

Show undocumented member
type transition_context = struct {
	transition,
	context_elements: []context_element,
};

type transition_delay[permalink]

Show undocumented member
type transition_delay = struct {
	transition,
	delay_duration: int,
};

type transition_event[permalink]

Show undocumented member
type transition_event = struct {
	transition,
	event_name: event_name,
};

type transition_exec[permalink]

Show undocumented member
type transition_exec = struct {
	transition,
	command: []str,
};

Errors

type bad_syntax[permalink]

Show undocumented member
type bad_syntax = !(unsupported_type | first_isnt_array | transition_isnt_object | missing_transition_type | missing_contexts | missing_event_name | missing_delay_duration | missing_command | type_isnt_str | command_isnt_array | contexts_isnt_object | context_value_isnt_str | transitions_isnt_array | delay_duration_isnt_int | event_name_isnt_str | command_argument_isnt_str);

type command_argument_isnt_str[permalink]

Show undocumented member
type command_argument_isnt_str = !void;

type command_isnt_array[permalink]

Show undocumented member
type command_isnt_array = !void;

type context_value_isnt_str[permalink]

Show undocumented member
type context_value_isnt_str = !void;

type contexts_isnt_object[permalink]

Show undocumented member
type contexts_isnt_object = !void;

type delay_duration_isnt_int[permalink]

Show undocumented member
type delay_duration_isnt_int = !void;

type error[permalink]

Show undocumented member
type error = !bad_syntax;

type event_name_isnt_str[permalink]

Show undocumented member
type event_name_isnt_str = !void;

type first_isnt_array[permalink]

Show undocumented member
type first_isnt_array = !void;

type missing_command[permalink]

Show undocumented member
type missing_command = !void;

type missing_contexts[permalink]

Show undocumented member
type missing_contexts = !void;

type missing_delay_duration[permalink]

Show undocumented member
type missing_delay_duration = !void;

type missing_event_name[permalink]

Show undocumented member
type missing_event_name = !void;

type missing_transition_type[permalink]

Show undocumented member
type missing_transition_type = !void;

type transition_isnt_object[permalink]

Show undocumented member
type transition_isnt_object = !void;

type transitions_isnt_array[permalink]

Show undocumented member
type transitions_isnt_array = !void;

type type_isnt_str[permalink]

Show undocumented member
type type_isnt_str = !void;

type unsupported_type[permalink]

Show undocumented member
type unsupported_type = !void;

Functions

fn context_element_str[permalink]

Show undocumented member
fn context_element_str(literal: str) (context_element | nomem);

fn context_elements_match_all[permalink]

Show undocumented member
fn context_elements_match_all(context_elements: []context_element, to_match_context_elements: []context_element) bool;

fn context_elements_set_key_if_present[permalink]

Show undocumented member
fn context_elements_set_key_if_present(context_elements: []context_element, key: str, value: str) (bool | nomem);

fn finish_context_element[permalink]

Show undocumented member
fn finish_context_element(elem: context_element) void;

fn finish_context_elements[permalink]

Show undocumented member
fn finish_context_elements(elems: []context_element) void;

fn finish_state[permalink]

Show undocumented member
fn finish_state(state: *state_machine) void;

fn finish_transition[permalink]

Show undocumented member
fn finish_transition(transition: *transition) void;

fn finish_transitions[permalink]

Show undocumented member
fn finish_transitions(transitions: []*transition) void;

fn load_transitions[permalink]

Show undocumented member
fn load_transitions(source: io::handle) ([]*transition | json::error | error | nomem);

fn state_forward[permalink]

Show undocumented member
fn state_forward(state: *state_machine, act: action) (bool | nomem);

fn str_context_element[permalink]

Show undocumented member
fn str_context_element(context_element: context_element) (str | nomem);

fn strerror[permalink]

Show undocumented member
fn strerror(err: error) str;

fn trigger_transition_delay_expired[permalink]

Show undocumented member
fn trigger_transition_delay_expired(state: *state_machine) void;

fn write_transitions[permalink]

Show undocumented member
fn write_transitions(handle: io::handle, transitions: []*transition) (void | io::error);