Struct pango::AttrIterator
source · #[repr(transparent)]pub struct AttrIterator { /* private fields */ }
Expand description
A AttrIterator
is used to iterate through a AttrList
.
A new iterator is created with AttrList::iterator()
.
Once the iterator is created, it can be advanced through the style
changes in the text using next()
. At each
style change, the range of the current style segment and the attributes
currently in effect can be queried.
Implementations§
source§impl AttrIterator
impl AttrIterator
sourcepub fn get(&mut self, type_: AttrType) -> Option<Attribute>
pub fn get(&mut self, type_: AttrType) -> Option<Attribute>
Find the current attribute of a particular type at the iterator location.
When multiple attributes of the same type overlap, the attribute whose range starts closest to the current location is used.
type_
the type of attribute to find
Returns
the current
attribute of the given type, or None
if no attribute
of that type applies to the current location.
sourcepub fn attrs(&mut self) -> Vec<Attribute>
pub fn attrs(&mut self) -> Vec<Attribute>
Gets a list of all attributes at the current position of the iterator.
Returns
a list of all attributes for the current range. To free
this value, call Pango::Attribute::destroy()
on each
value and g_slist_free() on the list.
sourcepub fn range(&mut self) -> (i32, i32)
pub fn range(&mut self) -> (i32, i32)
Get the range of the current segment.
Note that the stored return values are signed, not unsigned
like the values in Attribute
. To deal with this API
oversight, stored return values that wouldn’t fit into
a signed integer are clamped to G_MAXINT
.
Returns
start
location to store the start of the range
end
location to store the end of the range
source§impl AttrIterator
impl AttrIterator
sourcepub fn font(
&mut self,
desc: &mut FontDescription,
language: Option<&Language>,
extra_attrs: &[&Attribute]
)
pub fn font( &mut self, desc: &mut FontDescription, language: Option<&Language>, extra_attrs: &[&Attribute] )
Get the font and other attributes at the current iterator position.
desc
a FontDescription
to fill in with the current
values. The family name in this structure will be set using
Pango::FontDescription::set_family_static()
using
values from an attribute in the AttrList
associated
with the iterator, so if you plan to keep it around, you
must call:
pango_font_description_set_family (desc, pango_font_description_get_family (desc))
.
Returns
language
location to store language tag
for item, or None
if none is found.
extra_attrs
location in which to store a list of non-font attributes
at the the current position; only the highest priority
value of each attribute will be added to this list. In
order to free this value, you must call
Pango::Attribute::destroy()
on each member.
Trait Implementations§
source§impl Clone for AttrIterator
impl Clone for AttrIterator
source§impl Debug for AttrIterator
impl Debug for AttrIterator
source§impl Hash for AttrIterator
impl Hash for AttrIterator
source§impl Ord for AttrIterator
impl Ord for AttrIterator
source§fn cmp(&self, other: &AttrIterator) -> Ordering
fn cmp(&self, other: &AttrIterator) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere Self: Sized,
source§impl PartialEq<AttrIterator> for AttrIterator
impl PartialEq<AttrIterator> for AttrIterator
source§fn eq(&self, other: &AttrIterator) -> bool
fn eq(&self, other: &AttrIterator) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd<AttrIterator> for AttrIterator
impl PartialOrd<AttrIterator> for AttrIterator
source§fn partial_cmp(&self, other: &AttrIterator) -> Option<Ordering>
fn partial_cmp(&self, other: &AttrIterator) -> 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 AttrIterator
impl StaticType for AttrIterator
source§fn static_type() -> Type
fn static_type() -> Type
Self
.