gio

Struct SettingsSchemaSource

Source
pub struct SettingsSchemaSource { /* private fields */ }
Expand description

This is an opaque structure type. You may not access it directly.

GLib type: Shared boxed type with reference counted clone semantics.

Implementations§

Source§

impl SettingsSchemaSource

Source

pub fn as_ptr(&self) -> *mut GSettingsSchemaSource

Return the inner pointer to the underlying C value.

Source

pub unsafe fn from_glib_ptr_borrow(ptr: &*mut GSettingsSchemaSource) -> &Self

Borrows the underlying C value.

Source§

impl SettingsSchemaSource

Source

pub fn from_directory( directory: impl AsRef<Path>, parent: Option<&SettingsSchemaSource>, trusted: bool, ) -> Result<SettingsSchemaSource, Error>

Attempts to create a new schema source corresponding to the contents of the given directory.

This function is not required for normal uses of #GSettings but it may be useful to authors of plugin management systems.

The directory should contain a file called gschemas.compiled as produced by the [glib-compile-schemas][glib-compile-schemas] tool.

If @trusted is true then gschemas.compiled is trusted not to be corrupted. This assumption has a performance advantage, but can result in crashes or inconsistent behaviour in the case of a corrupted file. Generally, you should set @trusted to true for files installed by the system and to false for files in the home directory.

In either case, an empty file or some types of corruption in the file will result in G_FILE_ERROR_INVAL being returned.

If @parent is non-None then there are two effects.

First, if g_settings_schema_source_lookup() is called with the @recursive flag set to true and the schema can not be found in the source, the lookup will recurse to the parent.

Second, any references to other schemas specified within this source (ie: child or extends) references may be resolved from the @parent.

For this second reason, except in very unusual situations, the @parent should probably be given as the default schema source, as returned by g_settings_schema_source_get_default().

§directory

the filename of a directory

§parent

a #GSettingsSchemaSource, or None

§trusted

true, if the directory is trusted

Source

pub fn list_schemas(&self, recursive: bool) -> (Vec<GString>, Vec<GString>)

Lists the schemas in a given source.

If @recursive is true then include parent sources. If false then only include the schemas from one source (ie: one directory). You probably want true.

Non-relocatable schemas are those for which you can call g_settings_new(). Relocatable schemas are those for which you must use g_settings_new_with_path().

Do not call this function from normal programs. This is designed for use by database editors, commandline tools, etc.

§recursive

if we should recurse

§Returns
§non_relocatable

the list of non-relocatable schemas, in no defined order

§relocatable

the list of relocatable schemas, in no defined order

Source

pub fn lookup(&self, schema_id: &str, recursive: bool) -> Option<SettingsSchema>

Looks up a schema with the identifier @schema_id in @self.

This function is not required for normal uses of #GSettings but it may be useful to authors of plugin management systems or to those who want to introspect the content of schemas.

If the schema isn’t found directly in @self and @recursive is true then the parent sources will also be checked.

If the schema isn’t found, None is returned.

§schema_id

a schema ID

§recursive

true if the lookup should be recursive

§Returns

a new #GSettingsSchema

Source

pub fn default() -> Option<SettingsSchemaSource>

Gets the default system schema source.

This function is not required for normal uses of #GSettings but it may be useful to authors of plugin management systems or to those who want to introspect the content of schemas.

If no schemas are installed, None will be returned.

The returned source may actually consist of multiple schema sources from different directories, depending on which directories were given in XDG_DATA_DIRS and GSETTINGS_SCHEMA_DIR. For this reason, all lookups performed against the default source should probably be done recursively.

§Returns

the default schema source

Trait Implementations§

Source§

impl Clone for SettingsSchemaSource

Source§

fn clone(&self) -> Self

Makes a clone of this shared reference.

This increments the strong reference count of the reference. Dropping the reference will decrement it again.

1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for SettingsSchemaSource

Source§

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

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

impl From<SettingsSchemaSource> for Value

Source§

fn from(s: SettingsSchemaSource) -> Self

Converts to this type from the input type.
Source§

impl HasParamSpec for SettingsSchemaSource

Source§

type ParamSpec = ParamSpecBoxed

Source§

type SetValue = SettingsSchemaSource

Preferred value to be used as setter for the associated ParamSpec.
Source§

type BuilderFn = fn(_: &str) -> ParamSpecBoxedBuilder<'_, SettingsSchemaSource>

Source§

fn param_spec_builder() -> Self::BuilderFn

Source§

impl Hash for SettingsSchemaSource

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Ord for SettingsSchemaSource

Source§

fn cmp(&self, other: &SettingsSchemaSource) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for SettingsSchemaSource

Source§

fn eq(&self, other: &SettingsSchemaSource) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for SettingsSchemaSource

Source§

fn partial_cmp(&self, other: &SettingsSchemaSource) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl StaticType for SettingsSchemaSource

Source§

fn static_type() -> Type

Returns the type identifier of Self.
Source§

impl Eq for SettingsSchemaSource

Source§

impl StructuralPartialEq for SettingsSchemaSource

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, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GList> for T

Source§

impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GPtrArray> for T

Source§

impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GSList> for T

Source§

impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GList> for T

Source§

impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GPtrArray> for T

Source§

impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GSList> for T

Source§

impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GList> for T

Source§

impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GPtrArray> for T

Source§

impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GSList> for T

Source§

impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GList> for T

Source§

impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GPtrArray> for T

Source§

impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GSList> for T

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> IntoClosureReturnValue for T
where T: Into<Value>,

Source§

impl<T> Property for T
where T: HasParamSpec,

Source§

type Value = T

Source§

impl<T> PropertyGet for T
where T: HasParamSpec,

Source§

type Value = T

Source§

fn get<R, F>(&self, f: F) -> R
where F: Fn(&<T as PropertyGet>::Value) -> R,

Source§

impl<T> StaticTypeExt for T
where T: StaticType,

Source§

fn ensure_type()

Ensures that the type has been registered with the type system.
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> TransparentType for T

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> TryFromClosureReturnValue for T
where T: for<'a> FromValue<'a> + StaticType + 'static,

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.
Source§

impl<'a, T, C, E> FromValueOptional<'a> for T
where T: FromValue<'a, Checker = C>, C: ValueTypeChecker<Error = ValueTypeMismatchOrNoneError<E>>, E: Error + Send + 'static,