[]Struct pango::AttrList

pub struct AttrList(_);

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 AttrList::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

impl AttrList[src]

pub fn new() -> AttrList[src]

Create a new empty attribute list with a reference count of one.

Returns

the newly allocated AttrList, which should be freed with AttrList::unref.

pub fn copy(&self) -> Option<AttrList>[src]

Copy self and return an identical new list.

Returns

the newly allocated AttrList, with a reference count of one, which should be freed with AttrList::unref. Returns None if self was None.

pub fn filter<P: FnMut(&Attribute) -> bool>(&self, func: P) -> Option<AttrList>[src]

Given a AttrList and callback function, removes any elements of self for which func returns true and inserts them into a new list.

func

callback function; returns true if an attribute should be filtered out.

data

Data to be passed to func

Returns

the new AttrList or None if no attributes of the given types were found.

pub fn get_attributes(&self) -> Vec<Attribute>[src]

Gets a list of all attributes in self.

Feature: v1_44

Returns

a list of all attributes in self. To free this value, call Attribute::destroy on each value and glib::SList::free on the list.

pub fn get_iterator(&self) -> Option<AttrIterator>[src]

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 AttrIterator::destroy.

pub fn splice(&self, other: &AttrList, pos: i32, len: i32)[src]

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 AttrList::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)

pub fn update(&self, pos: i32, remove: i32, add: i32)[src]

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.

Feature: v1_44

pos

the position of the change

remove

the number of removed bytes

add

the number of added bytes

impl AttrList[src]

pub fn change(&self, attr: Attribute)[src]

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 AttrList::insert for creating a attribute list in order (potentially much slower for large lists). However, AttrList::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.

pub fn insert(&self, attr: Attribute)[src]

Insert the given attribute into the AttrList. It will be inserted after all other attributes with a matching start_index.

attr

the attribute to insert. Ownership of this value is assumed by the list.

pub fn insert_before(&self, attr: Attribute)[src]

Insert the given attribute into the AttrList. It will be inserted before all other attributes with a matching start_index.

attr

the attribute to insert. Ownership of this value is assumed by the list.

Trait Implementations

impl Clone for AttrList

impl Debug for AttrList[src]

impl Default for AttrList[src]

impl Eq for AttrList[src]

impl Hash for AttrList[src]

impl Ord for AttrList[src]

impl PartialEq<AttrList> for AttrList[src]

impl PartialOrd<AttrList> for AttrList[src]

impl StaticType for AttrList

impl StructuralEq for AttrList[src]

impl StructuralPartialEq for AttrList[src]

Auto Trait Implementations

impl RefUnwindSafe for AttrList

impl !Send for AttrList

impl !Sync for AttrList

impl Unpin for AttrList

impl UnwindSafe for AttrList

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<'a, T> ToGlibContainerFromSlice<'a, *const GList> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 

type Storage = (Option<List>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)

impl<'a, T> ToGlibContainerFromSlice<'a, *const GPtrArray> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 

type Storage = (Option<PtrArray>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)

impl<'a, T> ToGlibContainerFromSlice<'a, *mut GArray> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 

type Storage = (Option<Array>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)

impl<'a, T> ToGlibContainerFromSlice<'a, *mut GList> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 

type Storage = (Option<List>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)

impl<'a, T> ToGlibContainerFromSlice<'a, *mut GPtrArray> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 

type Storage = (Option<PtrArray>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToSendValue for T where
    T: ToValue + SetValue + Send + ?Sized

impl<T> ToValue for T where
    T: SetValue + ?Sized

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.