Struct gio::FileAttributeMatcher
source · pub struct FileAttributeMatcher { /* private fields */ }
Expand description
Determines if a string matches a file attribute.
GLib type: Shared boxed type with reference counted clone semantics.
Implementations§
source§impl FileAttributeMatcher
impl FileAttributeMatcher
sourcepub fn as_ptr(&self) -> *mut GFileAttributeMatcher
pub fn as_ptr(&self) -> *mut GFileAttributeMatcher
Return the inner pointer to the underlying C value.
sourcepub unsafe fn from_glib_ptr_borrow<'a>(
ptr: *const *const GFileAttributeMatcher,
) -> &'a Self
pub unsafe fn from_glib_ptr_borrow<'a>( ptr: *const *const GFileAttributeMatcher, ) -> &'a Self
Borrows the underlying C value.
source§impl FileAttributeMatcher
impl FileAttributeMatcher
sourcepub fn new(attributes: &str) -> FileAttributeMatcher
pub fn new(attributes: &str) -> FileAttributeMatcher
Creates a new file attribute matcher, which matches attributes against a given string. #GFileAttributeMatchers are reference counted structures, and are created with a reference count of 1. If the number of references falls to 0, the #GFileAttributeMatcher is automatically destroyed.
The @attributes string should be formatted with specific keys separated from namespaces with a double colon. Several “namespace::key” strings may be concatenated with a single comma (e.g. “standard::type,standard::is-hidden”). The wildcard “” may be used to match all keys and namespaces, or “namespace::” will match all keys in a given namespace.
§Examples of file attribute matcher strings and results
"*"
: matches all attributes."standard::is-hidden"
: matches only the key is-hidden in the standard namespace."standard::type,unix::*"
: matches the type key in the standard namespace and all keys in the unix namespace.
§attributes
an attribute string to match.
§Returns
a #GFileAttributeMatcher
sourcepub fn enumerate_namespace(&self, ns: &str) -> bool
pub fn enumerate_namespace(&self, ns: &str) -> bool
Checks if the matcher will match all of the keys in a given namespace.
This will always return true
if a wildcard character is in use (e.g. if
matcher was created with “standard::” and @ns is “standard”, or if matcher was created
using “” and namespace is anything.)
TODO: this is awkwardly worded.
§ns
a string containing a file attribute namespace.
§Returns
true
if the matcher matches all of the entries
in the given @ns, false
otherwise.
sourcepub fn matches_only(&self, attribute: &str) -> bool
pub fn matches_only(&self, attribute: &str) -> bool
sourcepub fn subtract(
&self,
subtract: Option<&FileAttributeMatcher>,
) -> Option<FileAttributeMatcher>
pub fn subtract( &self, subtract: Option<&FileAttributeMatcher>, ) -> Option<FileAttributeMatcher>
Subtracts all attributes of @subtract from @self and returns a matcher that supports those attributes.
Note that currently it is not possible to remove a single attribute when the @self matches the whole namespace - or remove a namespace or attribute when the matcher matches everything. This is a limitation of the current implementation, but may be fixed in the future.
§subtract
The matcher to subtract
§Returns
A file attribute matcher matching all attributes of @self that are not matched by @subtract
sourcepub fn to_str(&self) -> GString
pub fn to_str(&self) -> GString
Prints what the matcher is matching against. The format will be equal to the format passed to g_file_attribute_matcher_new(). The output however, might not be identical, as the matcher may decide to use a different order or omit needless parts.
§Returns
a string describing the attributes the matcher matches
against or None
if @self was None
.
Trait Implementations§
source§impl Clone for FileAttributeMatcher
impl Clone for FileAttributeMatcher
source§impl Debug for FileAttributeMatcher
impl Debug for FileAttributeMatcher
source§impl Display for FileAttributeMatcher
impl Display for FileAttributeMatcher
source§impl From<FileAttributeMatcher> for Value
impl From<FileAttributeMatcher> for Value
source§fn from(s: FileAttributeMatcher) -> Self
fn from(s: FileAttributeMatcher) -> Self
source§impl HasParamSpec for FileAttributeMatcher
impl HasParamSpec for FileAttributeMatcher
type ParamSpec = ParamSpecBoxed
§type SetValue = FileAttributeMatcher
type SetValue = FileAttributeMatcher
type BuilderFn = fn(_: &str) -> ParamSpecBoxedBuilder<'_, FileAttributeMatcher>
fn param_spec_builder() -> Self::BuilderFn
source§impl Hash for FileAttributeMatcher
impl Hash for FileAttributeMatcher
source§impl IntoIterator for FileAttributeMatcher
impl IntoIterator for FileAttributeMatcher
source§impl Ord for FileAttributeMatcher
impl Ord for FileAttributeMatcher
source§fn cmp(&self, other: &FileAttributeMatcher) -> Ordering
fn cmp(&self, other: &FileAttributeMatcher) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl PartialEq for FileAttributeMatcher
impl PartialEq for FileAttributeMatcher
source§fn eq(&self, other: &FileAttributeMatcher) -> bool
fn eq(&self, other: &FileAttributeMatcher) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd for FileAttributeMatcher
impl PartialOrd for FileAttributeMatcher
source§fn partial_cmp(&self, other: &FileAttributeMatcher) -> Option<Ordering>
fn partial_cmp(&self, other: &FileAttributeMatcher) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl StaticType for FileAttributeMatcher
impl StaticType for FileAttributeMatcher
source§fn static_type() -> Type
fn static_type() -> Type
Self
.impl Eq for FileAttributeMatcher
impl StructuralPartialEq for FileAttributeMatcher
Auto Trait Implementations§
impl Freeze for FileAttributeMatcher
impl RefUnwindSafe for FileAttributeMatcher
impl !Send for FileAttributeMatcher
impl !Sync for FileAttributeMatcher
impl Unpin for FileAttributeMatcher
impl UnwindSafe for FileAttributeMatcher
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)