Struct Context

Source
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

Source

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

Source

pub fn get_raw_ptr(&self) -> *mut xkb_context

get the raw pointer from this context

Source

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.

Source

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

Source

pub fn include_path_append_default(&mut self) -> bool

Append the default include paths to the context’s include path.

Returns true on success.

Source

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

Source

pub fn include_path_clear(&mut self)

Remove all entries from the context’s include path.

Source

pub fn include_paths(&self) -> ContextIncludePaths<'_>

get an iterator on the include paths of this context

Source

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.

Source

pub fn get_log_level(&self) -> LogLevel

Source

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.

Source

pub fn get_log_verbosity(&self) -> i32

Trait Implementations§

Source§

impl Clone for Context

Source§

fn clone(&self) -> Context

Returns a duplicate 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 Drop for Context

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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,

Source§

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>,

Source§

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>,

Source§

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.