Struct pango::AttrList [−][src]
pub struct AttrList(_);
Expand description
The AttrList
structure represents a list of attributes
that apply to a section of text. The attributes are, in general,
allowed to overlap in an arbitrary fashion, however, if the
attributes are manipulated only through change()
,
the overlap between properties will meet stricter criteria.
Since the AttrList
structure is stored as a linear list,
it is not suitable for storing attributes for large amounts
of text. In general, you should not use a single AttrList
for more than one paragraph of text.
Implementations
This is supported on crate feature v1_44
only.
v1_44
only.Gets a list of all attributes in self
.
Returns
a list of all attributes in self
. To free this value, call
pango_attribute_destroy()
on each value and g_slist_free()
on the list.
Create a iterator initialized to the beginning of the list.
self
must not be modified until this iterator is freed.
Returns
the newly allocated AttrIterator
, which should
be freed with pango_attr_iterator_destroy()
.
This function opens up a hole in self
, fills it in with attributes from
the left, and then merges other
on top of the hole.
This operation is equivalent to stretching every attribute
that applies at position pos
in self
by an amount len
,
and then calling change()
with a copy
of each attribute in other
in sequence (offset in position by pos
).
This operation proves useful for, for instance, inserting a pre-edit string in the middle of an edit buffer.
other
another AttrList
pos
the position in self
at which to insert other
len
the length of the spliced segment. (Note that this
must be specified since the attributes in other
may only be present at some subsection of this range)
This is supported on crate feature v1_44
only.
v1_44
only.Update indices of attributes in self
for
a change in the text they refer to.
The change that this function applies is
removing remove
bytes at position pos
and inserting add
bytes instead.
Attributes that fall entirely in the
(pos
, pos
+ remove
) range are removed.
Attributes that start or end inside the
(pos
, pos
+ remove
) range are shortened to
reflect the removal.
Attributes start and end positions are updated
if they are behind pos
+ remove
.
pos
the position of the change
remove
the number of removed bytes
add
the number of added bytes
Insert the given attribute into the AttrList
. It will
replace any attributes of the same type on that segment
and be merged with any adjoining attributes that are identical.
This function is slower than insert()
for
creating an attribute list in order (potentially much slower
for large lists). However, insert()
is not
suitable for continually changing a set of attributes
since it never removes or combines existing attributes.
attr
the attribute to insert. Ownership of this value is assumed by the list.
Trait Implementations
Returns the type identifier of Self
.
Auto Trait Implementations
impl RefUnwindSafe for AttrList
impl UnwindSafe for AttrList
Blanket Implementations
Mutably borrows from an owned value. Read more
impl<'a, T, C> FromValueOptional<'a> for T where
C: ValueTypeChecker<Error = ValueTypeMismatchOrNoneError>,
T: FromValue<'a, Checker = C>,