pub struct Context { /* private fields */ }Expand description
Top level library context object.
The context contains various general library data and state, like logging level and include paths.
Objects are created in a specific context, and multiple contexts may coexist simultaneously. Objects from different contexts are completely separated and do not share any memory or state.
Implementations§
Source§impl Context
impl Context
Sourcepub unsafe fn from_raw_ptr(ptr: *mut xkb_context) -> Context
pub unsafe fn from_raw_ptr(ptr: *mut xkb_context) -> Context
contruct a context from a raw ffi pointer. This context must already been
referenced as xkb_context_unref will be called at drop time
Sourcepub fn get_raw_ptr(&self) -> *mut xkb_context
pub fn get_raw_ptr(&self) -> *mut xkb_context
get the raw pointer from this context
Sourcepub fn new(flags: ContextFlags) -> Context
pub fn new(flags: ContextFlags) -> Context
Create a new context.
flags Optional flags for the context, or 0.
The user may set some environment variables to affect default values in the context.
Sourcepub fn include_path_append(&mut self, path: &Path) -> bool
pub fn include_path_append(&mut self, path: &Path) -> bool
append a new entry to the context’s include path returns true on success, or false if the include path could not be added or is inaccessible
Sourcepub fn include_path_append_default(&mut self) -> bool
pub fn include_path_append_default(&mut self) -> bool
Append the default include paths to the context’s include path.
Returns true on success.
Sourcepub fn include_path_reset_defaults(&mut self) -> bool
pub fn include_path_reset_defaults(&mut self) -> bool
Reset the context’s include path to the default.
Removes all entries from the context’s include path, and inserts the default paths.
Returns true on success.yy
Sourcepub fn include_path_clear(&mut self)
pub fn include_path_clear(&mut self)
Remove all entries from the context’s include path.
Sourcepub fn include_paths(&self) -> ContextIncludePaths<'_> ⓘ
pub fn include_paths(&self) -> ContextIncludePaths<'_> ⓘ
get an iterator on the include paths of this context
Sourcepub fn set_log_level(&mut self, level: LogLevel)
pub fn set_log_level(&mut self, level: LogLevel)
Set the current logging level.
The default level is xkb::LogLevel::Error. The environment variable
XKB_LOG_LEVEL, if set in the time the context was created, overrides the
default value. It may be specified as a level number or name.
pub fn get_log_level(&self) -> LogLevel
Sourcepub fn set_log_verbosity(&mut self, verbosity: i32)
pub fn set_log_verbosity(&mut self, verbosity: i32)
Sets the current logging verbosity.
The library can generate a number of warnings which are not helpful to ordinary users of the library. The verbosity may be increased if more information is desired (e.g. when developing a new keymap).
The default verbosity is 0. The environment variable XKB_LOG_VERBOSITY,
if set in the time the context was created, overrides the default value.
verbosity can be set from 1 to 10, higher values being more verbose. 0 would result in no verbose messages being logged.
Most verbose messages are of level xkb::LogLevel::Warning or lower.